You’ve been doing this SET ANALYSIS thing for a while, and you’re are about to get serious about it. You might have tried SET ANALYSIS on your own & using QlikCommunity help. As a developer it’s important to use the common standard vocabulary while talking with fellow developers about the expressions/scripts. As you’re aware that SET expressions are not syntax friendly with loads of special characters. Let’s understand different components in SET ANALYSIS expression.

What makes SET ANALYSIS?

SET ANALYSIS has three components: SET IDENTIFIER, SET MODIFIER and SET OPERATOR. Let’s understand these three components based on simple analogy. We were given a task to count single men who are 30 years & single women who are 25 years of age, who live in London.

What is SET IDENTIFIER?

SET ANALYSIS is built based on Set theory, which is one of the mathematical branches. The term “IDENTIFIER” refers to identify the active SET in the set expression. In simple words, IDENTIFIER refers to the kind of SET:

• “1” represents full set
• “\$” represents current selection set
• “\$1” represents previous selection set
• “Bookmark02” represents set saved as bookmark

Based on our task/example, we need to identify people who live in London. Because we only need to count people who live in London, so that will be our active/base SET. SET IDENTIFIER is always referred in curly braces {}. Let’s assume that we have list box with the city names, then we can select – “London”. This will become our current selection set. There are different ways to write this expressions but our focus is on “SET IDENTIFIER” hence I’ll refer the example to use the current selection set.

What is SET MODIFIER?

We can compare Set Modifier to SQL WHERE clause. Once we’ve identified the base SET then we can modify the BASE SET based on the required conditions. According to SET ANALYSIS syntax, SET MODIFIERS always begin and end in the angular braces (I.e. <>).

Logically, imagine that SET MODIFIERS evaluating each row to a Boolean value (i.e. TRUE OR FALSE). Wherever we get TRUE values for the condition, QlikView will keep them as part of the SET and ignores other rows. But this may not be physical processing/parsing of the actual SET expression.

Based on our task/example, we can use the modifier on the fields like GENDER & AGE. So it will be <GENDER = {‘Male’}, AGE = {30}>

What is SET OPERATOR?

Like Arithmetic Operators: (+) Addition, (-) Subtraction, (x or *) Multiplication and (/) Division etc. Same way, we have SET OPERATORS which works in similar way as Arithmetic Operators. Some of the SET OPERATORS are (+) Union, (-) Exclusion, (*) Intersection and (/) Symmetric Difference. SET OPERATORS work on the SET instead of individual rows. Logically, QlikView starts the SET expression evaluation with the SET IDENTIFIER, then SET MODIFIER and finally uses the SET OPERATOR.