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: 
anuradhaa
Partner - Creator II
Partner - Creator II

Using Aggr function inside Set analysis

Hi,

I'm Using below aggr function to calculate sums.

=Sum(Aggr(

money((if(OWNER='ABC',0,

(if(((OWNER='EFG' or OWNER='HIJ') and (Date#(MonthYear,'MMM-YY') <= date#('Jun-14','MMM-YY')))

,sum(EFG_Total),(if((OWNER='EFG'),sum(EFG_Total),(if((Date#(MonthYear,'MMM-YY') <= date#('Jun-14','MMM-YY')),

((if((sum(COUNT)<=3000),((sum(COUNT)*.1)*9.6),if((sum(COUNT)>3000 and  sum(COUNT)<=4000),

((((sum(COUNT)-3000)*.083)+158)*9.6),((((sum(COUNT)-4000)*.071)+5897)*9.6))))) ,

((if((sum(COUNT)<=3000),((sum(COUNT)*.101)*9.6),if((sum(COUNT)>3000 and  sum(COUNT)<=4000),

((((sum(COUNT)-3000)*.0897)+848)*9.6),

((((sum(COUNT)-4000)*.0487)+1646)*9.6)))))))))))))), OWNER,MonthYear))

Now i want to compare sums of two years (current year (selected year) and previous year. So i can use set analysis to compare it.

Sum({$<Year={$(=Max(Year)-1)}>}Value)    and

Sum({$<Year={$(=Max(Year))}>}Value)

But i can't use Aggr here because if i select year it only display selected year since i use year inside my aggr.

Please help me

0 Replies