Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis

I used below set theory in a text box:

Sum( {<Year = {2011}>}   Sales)

In the dashboard if I select :

1. Year as 2011. Sum of Sales displayed for 2011.

2. Date(s) of 2011. Sum of sales on those dates is displayed.

3. Year as 2012. Sum of Sales displayed for 2011.

4. Date(s) of 2012. 0 is displayed.

---------------------------------------------------

Suppose 2011 no sales in the month of dec,,,,,, but 2012 have data for dec as well.

---------------------------------------------------

5. Select Dec . 0 is displayed.

6. Any other month(s). Sum for that month in 2011 is displayed.

Can anyone kindly help me with valid justification for this behaviour of set analysis.

Thanks & Regards

Suhas Gupta

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

In this expression Sum( {<Year = {2011}>} Sales) only the selection for field Year is fixed. It's fixed to the value 2011. This determines the set. The set is calculated first, after that the other selections are applied.

If you select dates in 2011 then the expression is applied to the selected dates that are part of the set. Dates in 2012 are not in the set calculated for Year = {2011}. So you get no result if you select dates in 2012.

If you select year 2012 then that selection is ignored because you specified Year = {2011} for the set. So you get the result for 2011 if you select 2012.

If you select Dec you get Dec 2011. If you select another month you get the sum for that month in 2011. Only Year was fixed in the set to 2011. Selections in the other fields are still applied.


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

In this expression Sum( {<Year = {2011}>} Sales) only the selection for field Year is fixed. It's fixed to the value 2011. This determines the set. The set is calculated first, after that the other selections are applied.

If you select dates in 2011 then the expression is applied to the selected dates that are part of the set. Dates in 2012 are not in the set calculated for Year = {2011}. So you get no result if you select dates in 2012.

If you select year 2012 then that selection is ignored because you specified Year = {2011} for the set. So you get the result for 2011 if you select 2012.

If you select Dec you get Dec 2011. If you select another month you get the sum for that month in 2011. Only Year was fixed in the set to 2011. Selections in the other fields are still applied.


talk is cheap, supply exceeds demand
Not applicable
Author

here Year =2011 is fixed

so you can try this expression

=Sum( {$}   sales)

or


sum({<year={"$(=year)"}>}sales)

er_mohit
Master II
Master II

if you want the data on selection then

as per your expression you fixed to 2011

try this

Sum({<Year={"$(=year)"}>}Sales)