Qlik Set Analysis Primer
Qlik Set Analysis Primer
Aggregation functions normally aggregate over the set of possible records defined by the
current selections and dimensions.
sum( Sales )
2. Provides a method of defining groups (sets) of information that are independent of the current selections.
6. A set modifies the context only during the expression that uses it.
7. Set Analysis expression is calculated once per chart and not for each row.
Set Analysis Syntax
Three Components Two curly braces:
Set identifier (defines scope of {} Outer curly braces for the
the record set) Required record set
Set modifier (adds filters) {} Inner curly braces for the
Optional element set
Set operators (allow interactions <> Modifiers
between sets)
Assignment operator
There is always an = sign between the field name and element set in the
Field name
modifier
◉ sum({1 - $} Sales)
Returns sales for everything excluded by the current selection.
◉ sum({Group1} Sales)
Returns sales for selections made in filters with alternate states ‘Group1’
Set Modifiers: Examples
>
Selections
A B A B
A B A B
< [Category Name] -= {'Seafood'}> < [Category Name] += {'Seafood'}> < [Category Name] *= {'Seafood, ‘Beverages'}> < [Category Name] /= {'Seafood'}>
Removes Seafood category from the user selection Includes all selected categories plus Seafood Excludes all categories but Seafood and Beverages Includes all categories but Seafood
Indirect Set Analysis using P() and E() functions
◉ The functions p() and e() can be used to select the set of possible or excluded values
within a field.
P() = possible values in a field based on the current selections as an element set
E() = excluded values in a field based on the current selections as an element set
Indirect Set Analysis using P() and E() functions
Sum( {<CarManufactureYear = p(CarManufactureYear)>} [Annual Premium])
Possible
(white)
Selected(green)
Excluded
(dark
grey)
Advanced Set Analysis
Aggregation as an element set values
Modifiers are sets too! = Sign in the modifier Two Curly braces {}
Remember that both LHS and Is not an equal sign. It is an Outer curly braces for the
RHS of the modifiers are sets assignment by association record set and inner curly
braces for the elementset
Modifier starts with left angle Litteral values need single Record set can be in a default
bracket and ends with right quote; search string or state while element set can be
bracket. expression requires double in different state such as
quotes and numeric values alternate state.
require no quotes.
Thanks!
Created by:
Shilpan Patel, Analyticshub.io/academy/