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!

The standard way to write selections in a set modifier is to use an equals sign. For example:

Year = {">2015"}

The expression to the right of the equals sign in the set modifier is called an element set. It defines a set of distinct field values, in other words a selection.

This notation defines a new selection, disregarding the current selection in the field. So, if the set identifier contains a selection in this field, the old selection will be replaced by the one in the element set.

When you want to base your selection on the current selection in the field, you need to use a different expression

For example, if you want to respect the old selection, and add the requirement that the year is after 2015, you can write the following:

Year = Year * {">2015"}

The asterisk is a set operator defining an intersection, so you will get the intersection between the current selection in Year, and the additional requirement that the year be after 2015. An alternative way to write this is the following:

Year *= {">2015"}

That is, the assignment operator (*=) implicitly defines an intersection.

Similarly, implicit unions, exclusions and symmetric differences can be defined using the following: +=, –=, /=

Examples: Chart expressions for set modifiers with implicit set operators

Load script

Load the following data as an inline load in the data load editor to create the chart expression examples below.

For more information about using inline loads, see Inline loads.

Chart expressions with implicit set operators

Create a table in a Qlik Sense sheet with the following chart expressions.

Select Canada and Czech Republic from a list of countries.

Table - Chart expressions with implicit set operators

Country

Sum(Amount)

Sum({<Country*={Canada}>} Amount)

Sum({<Country-={Canada}>} Amount)

Sum({<Country+= {France}>} Amount)

Totals

24

14

10

28

Canada

14

14

0

14

Czech Republic

10

0

10

10

France

0

0

0

4

Explanation

Dimensions:

Country

Measures:

Sum(Amount)

Sum Amount for the current selection. Note that only Canada and Czech Republic have non-zero values.

Sum({<Country*={Canada}>}Amount)

Sum Amount for the current selection, intersected with the requirement that the Country be Canada. If Canada is not part of the user selection, the set expression returns an empty set, and the column will have 0 on all rows.

Sum({<Country-={Canada}>}Amount)

Sum Amount for the current selection, but first exclude Canada from the Country selection. If Canada is not part of the user selection, the set expression will not change any numbers.

Sum({<Country+={France}>}Amount)

Sum Amount for the current selection, but first add France to the Country selection. If France is already part of the user selection, the set expression will not change any numbers.