Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
happyjoshua777
Creator
Creator

aggr(Sum(1), Country) expression on p. 114 of QlikView Cookbook

how are you?

I am struggling to understand the following expression:

=if(
Aggr(Sum(1), Country)>0,
'Selected: $(=Concat(DISTINCT Country, ', '))',
'Others: $(=Concat({<Country=E({$})>} DISTINCT Country, ',
'))'
)

Specifically, I do not understand how Aggr(Sum(1), Country)

"Will only evaluate for those countries that are currently selected because Sum(1) will be null
for the unselected countries.
"

I always assumed that in order to evaluate only selected dimensions, 'countries' in this case, one should use '$'

i.e. Aggr(Sum($), Country

In addition, why would Sum(1) amount to null for the countries which were not selected?



thank you

3 Replies
techvarun
Specialist II
Specialist II

0 - Represents an empty set

1 - Represents the full set of all the records in the application

$ - Represents the records of the current selection

$1 - Represents the previous selection

$_1 - Represents the next (forward) selection

tresesco
MVP
MVP

I guess, you are mixing up '1' with '{1}'. If you use Sum(1), there is nothing to do with explicit set analysis. So by default, only the selected values/within scope values would be considered in expression. Whereas, had this been like Sum ({1} ...) - the result would have been irrespective of any selections.

Hope this helps.

happyjoshua777
Creator
Creator
Author

is there a manual which describes '1' as a function parameter, such as SUM(1)?

I wanted to read more about it.

thank you