Exponential and logarithmic functions are used in calculations to transform data.

This article will cover the basic principles of working with these functions, including:

  • The general function syntax
  • Working with exponential & logarithmic functions in the data load editor
  • Working with exponential & logarithmic functions in charts

For a complete, up-to-date list of functions, please see the Qlik Sense help pages here.

The exponential & logarithmic function syntax

Not surprisingly, the function syntax can differ massively depending on the function. For up-to-date syntax, please do refer to the Qlik help pages here.

Understanding the exponential and logarithmic syntax given by Qlik Sense

Unfortunately, it isn’t easy to decipher the syntax provided in the help pages linked to above if you aren’t used to reading it. In this section, we will explain how to read this syntax so that you can apply this thinking to every function in the help pages. For exponential and logarithmic functions, the syntax is relatively easy to get the hang of.

To explain the syntax, we will use a function as an example to explain the syntax.

Example 1: Pow

This function returns a result to the formula x^y.

The rules for reading this are as follows:

  1. The function name itself is first and all the parameters you need to enter go between brackets: ().
  2. The various elements you will need to enter are separated by commas. In this function, there are 2 elements: the x and y.
  3. Anything between square brackets [] is an optional parameter. This function, nor any of the other exponential and logarithmic functions, doesn’t have any optional parameters.

An example of this function being used could be:

The result would be 8.

The rest of the functions are equally simple – they are just numerical transformations for which you would traditionally find a button on a scientific calculator.

How to use exponential and logarithmic functions in the data load editor

Now that you understand how to read the syntax of Qlik functions, you need to understand how to use exponential and logarithmic functions in the load. The rules are:

  • The functions can be used throughout the whole load script, not just within a LOAD or SELECT statement
  • They are fairly niche in that you will likely use them for modelling purposes
  • The functions can be nested and combined with other types of functions

A very basic load may look something like this:

SALES:
LOAD
   "Date",
   "Sales",
   Log("Sales") as "Log of Sales"

FROM [my_data.qvd] (qvd);

The loaded table will include the field “Date” and “Sales”. The third field is “Log of Sales” and can be used for regression modelling if required.

How to use exponential and logarithmic functions in visualisations

All logarithmic and exponential functions can be used directly in visualisations. The rules are as follows:

  • The functions can be nested and combined with other types of functions.
  • The functions can be used with dimensions or measures depending on your needs.

Here is an example of the Log() function being used in a line chart. The secondary axis (on the right of the chart) contains the function: