Skip to main content Skip to complementary content

Using functions in charts

A function is a type of procedure or routine that performs a specific task on data in apps. Qlik Sense contains several hundred ready-made functions that can be used in charts when creating visualizations. Functions can be, for example, mathematical, logical, can operate on financial or date and time information, can be used to manipulate strings, and other situations.

Functions can be grouped into the types:

  • Aggregation functions, which use several records as input and produce a single value result.
  • Scalar functions, which take a single input and produce a single output.
  • Range functions, which produce a single value based on a range of input values.
  • Range-producing functions, which are like range functions, but produce a range of values as output.

Many of the functions can be used in both chart expressions and scripts, but some are specific for chart expressions.

The following list shows some examples of functions:

  • Max: an aggregation function that can be used in scripts and charts.

    For example: Max(Sales) calculates the highest value in the field Sales.

  • IF: a conditional function that can be used in scripts and charts.

    For example: IF(Amount>0, 'OK','Alarm') determines if the condition 'is the value of Amount greater than zero?' is met. If it is, OK is written, otherwise Alarm is written.

  • Date#: an interpretation function that can be used in scripts and charts.

    For example: Date#(A) takes the input value A and evaluates it as a date.

Information noteA few differences exist between script expressions and chart expressions in terms of syntax and available functions. The most important difference is the role of the aggregation functions and the use of field references. The basic rule is that any field name in a chart expression must be enclosed by exactly one aggregation function. An aggregation function can never have another expression containing an aggregation function as argument.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!