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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
P_McDermott
Contributor
Contributor

Order of Operations in Set Analysis

Hi There,

I have a measure where I am using Set Analysis to limit my data to the last month.

Here is the full statement where the variable vLastMonth is equal to Month(NOW())-1

Sum({1<MonthNum={'$(vLastMonth)'}>}ASCAdj*LBS)+Sum({1<MonthNum={'$(vLastMonth)'}>}SterAdj*LBS))/Sum({1<MonthNum={'$(vLastMonth)'}>}Kgs)

My question is in the following:

Sum({1<MonthNum={'$(vLastMonth)'}>}ASCAdj*LBS)

will the result be Sum(ASCAdj)*LBS where only the value for ASCAdj will be filtered by the Set Analysis

or

Will the result be Sum(ASCAdj*LBS) where both values ASDAdj & LBS are filtered by the Set Analysis?

Or would it be best to have it like:

(Sum({1<MonthNum={'$(vLastMonth)'}>}ASCAdj)*Sum({1<MonthNum={'$(vLastMonth)'}>}LBS))+(Sum({1<MonthNum={'$(vLastMonth)'}>}SterAdj)*Sum({1<MonthNum={'$(vLastMonth)'}>}LBS))
/Sum({1<MonthNum={'$(vLastMonth)'}>}Kgs)

 

Thanks for your help

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Both will be filtered for the last month. Think of it as a row by row evaluation where set analysis will only pick rows where MonthNum  = 1 and for those rows do ASCAdj*LBS and then sum it

View solution in original post

2 Replies
sunny_talwar
MVP
MVP

Both will be filtered for the last month. Think of it as a row by row evaluation where set analysis will only pick rows where MonthNum  = 1 and for those rows do ASCAdj*LBS and then sum it

P_McDermott
Contributor
Contributor
Author

Thanks So Much!