Hi
In previous posts I’ve talked about the QlikView Engine Explaining Symbol and Data tables and how QlikView understand Selections using the Logical Inference
Here we will be taking the concept one step further and talk about how QlikView uses these new tables and logic when calculation an expression with Set Analysis.
Set Analysis is merely an additional set of state vectors created by the logical inference engine:
Here we can see two values within the Product Symbol table are possible in the current selection as their State Vector is 1. The next two columns created by QlikView are as s direct result of the Set Analysis statement $<Product={Boots,Cap}>. The expression would only aggregate values for ‘Boots’ though as this is the only possible State Vector in the example. The reason being is the ‘Cap’ is exclude by another selection. Maybe the ‘Year’ selected by the user is 2015 and they haven’t sold any ‘Caps’ in this time period.
The syntax of a QlikView expressions is:
Sum(Sales) |
|
Sum( {…} Sales) |
|
Sum({ $<Month={…}>} Sales) |
|
Sum({ $<Month={“…”}>} Sales) |
|
Sum({ $<Month={“<=$(…)“}>} Sales) |
|
Set Expressions are evaluated by the Logical Inference Engine, It is done before aggregation made by the calculation engine. Hence, a set expression can’t be evaluated row-by-row. This can be explained further by looking at the order in which QlikView calculates the expression.
Order | Expression | Comments |
1 | Sum( { $<Month= {“<=$(=Max(X))”}>} Sales) | Dollar Expansion |
2 | Sum( { $<Month= {“<=5”}>} Sales) | Parsing of Expression |
3 | Sum( { $<Month= {“<=5”}>} Sales) | Set Analysis Expression Evaluated |
4 | Sum( { $<Month= {“<=5”}>} Sales) | Cube Expansion and Aggregations |
Happy Qliking!
Richard
Hi Richard, Great post. It doesn’t work for everybody but, for some, understanding a little of the underlying nuts and bolts helps understand how to use set analysis better.
You have a few left curly braces missing in your example syntax. For example, Sum( $} is missing the first left curly brace.
Thanks for the blog.
-Tim (QlikView Maven)
LikeLike
Thanks Tim!!
Updated the post now, cheers.
Richard
LikeLike