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: 
vipingarg23
Creator
Creator

Aggr in Set analysis

I am trying to exclude some fields using set analysis with aggregation function

I am using below sample expression

Sum(Aggr(sum({$<A={'3'},B={'AP'}>}Total),dim))

I want to apply Aggr function only for B instead of both (A,B). Is it possible?

14 Replies
sunny_talwar

Not sure what you are after, but may be this

Sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))', '$(=$(Var3))'}>}Aggr(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Total)*(

(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Cost)/sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var2))'}>}Total))-

(sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var3))'}>}Cost)/sum({$<A={'<=$(=$(Var1))'},Year={'$(=$(Var3))'}>}Total))),dim))

vipingarg23
Creator
Creator
Author

Great Sunny. I was stuck in the same since long. You made my day. Thank you very much for your help.

vipingarg23
Creator
Creator
Author

Sunny..One thing, I  just want to know that what is the difference between both expression. Should we always use the expression (Which you told) in AGGR with set analysis or Is there any other logic behind it?

sunny_talwar

Well the outer aggregation should include the same set analysis that is needed for the inner one else the row wise number might match, but the total from the outer aggregation may filter out things....

vipingarg23
Creator
Creator
Author

Thanks for clarification sunny..