Field functions return information about field selections in a Qlik Sense app. These functions are relatively easy to use when the selections are made in fields. However, sometimes, as a developer, you may create dimensions using expressions in the front end instead of during the load. When attempting to use field functions to get the selections made in these derived dimensions, the syntax must be slightly different to work correctly. This article will explain how field functions can still be used when looking for selections made in derived dimensions.

How to use field functions with normal derived dimensions

Assume we have a Date field in an app that contains the daily date, i.e. 01/01/2024, 02/01/2024 etc., and we have derived a Year filter from this date by using the following expression:

Using this expression in a filter pane field yields a filter for the year:


If we wanted to use the GetSelectedCount() or GetFieldSelections() in this field, the following wouldn’t work:

=GetSelectedCount(Year(Date))

=GetFieldSelections(Year(Date))

Both of these expressions will return a NULL result.

To get the functions to work, the expressions must be surrounded by double quotes and contain an equals sign in front of them as such:

=GetSelectedCount("=Year(Date)")

=GetFieldSelections("=Year(Date)")

How to use field functions with derived dimensions stored as master items

Note that the above syntax also applies when looking for selections in a master dimension that has been derived using expressions. For example, assume we have stored the following dimension as a master item called Month.

There is no way to refer to this master dimension by its name. To use get information about the selections made in this dimension, you must use the expression that is deriving it inside the field functions as follows:

=GetSelectedCount("=Month(Date)")

=GetFieldSelections("=Month(Date)")