Qlik Community

QlikView Documents

Documents for QlikView related information.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.

Set expression and dollar expansion

Employee
Employee

Set expression and dollar expansion

Quite often I see examples in the community where dollar expansions are used in set expressions. Nothing wrong with using variables to populate expressions, but it is easy to make mistakes if you do not consider what value the dollar expansion will actually expand into the expression. The example below gives a brief introduction to how you can validate that the dollar expansion is accurate and the value you are expecting.

In the example below I have loaded a calendar of 2014, and added a Max() aggregation that shows the highest day in each month.

1.png

Now I move the Max() aggregation into a set expression, where I have a set modifier that selects the max day.


count({<Day={"$(=Max(Day))"}>} Day)

The result will be as below, where there is a 1 for every moth that has 31 days and a 0 for the other months. Notice that the expression label shows exactly which set expression has been evaluated, and that the set modifier is Day=31 and not the actual aggregation.

2.png

This shows that the dollar expansion is done first and then the expression is evaluated in the chart. The aggregation in the set modifier will therefore only be evaluated once. The expanded value is also equal to the expression total of the expanded aggregation.

3.png

Leave the expression label blank for troubleshooting or validation, so that you can see the fully expanded expression in the chart.

4.png

For longer expression, or to avoid clearing the expression label, simply move the expanded aggregation into a separate expression and look at its Expression Total. This is set in the expression Total Mode setting

5.png

Comments
rik_qlik
New Contributor III

Hi @tko, a question:

why count({<Day={"$(=Max(Day))"}>} Day) is not equal to write:

count({<Day={"=$(=Max(Day))"}>} Day)?

It's seem to have another behavior..

Thanks to your help!

Version history
Revision #:
1 of 1
Last update:
‎05-05-2015 08:34 PM
Updated by:
Employee