Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Live chat with experts, bring your API Integration questions. June 15th, 10 AM ET. REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Why is there a need to specify the same set expression twice?

Why do I have to specify the same set expression ( {<Year={2012}>} ) twice? First time for sum() and second for max().


=Max({<Year={2012}>} aggr (sum( {<Year={2012}>} Sale),Company_Name,Product))


Initially I though there would be enough to state it for sum, so that only the rows for 2012 would be passed on to the max().


I have taken the example from:

http://www.analyticsvidhya.com/blog/2014/02/aggr/

The blogger states that the expression is needed twice, but unfortunately not why.


3 Replies
Not applicable
Author

I believe it is only a waste of processing

The Set Expression with the definition only in the sum statement works perfectly!

=Max( aggr (sum( {<Year={2012}>} Sale),Company_Name,Product))


A "set statement" creates a static set of data, should be included only in the part that defines the value

Not applicable
Author

As I stated in my initial post and stated by the original blogger, both are needed to get correct result.

JonnyPoole
Employee
Employee

Each aggregation function can leverage a unique set statement whether or not its inclusive of the inner set or not. This is for maximum flexbility

Below for example, the inner set is on AccountID=1 , but the outer set is on AccountID=2

so what happens ?

the outer is what is used on where to render the values, but the inner set  is being used for the subtotalling .

pretty flexible.

Capture.PNG