Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
shamitshah
Partner - Creator
Partner - Creator

Set Analysis - Aggr Function with If statement

Hi,

 

I have the following expression which works :

Sum(Aggr(Sum(NO_OF_TCKTS),WOFY,State,Store,Department))

I am trying to incorporate the below if statement into the above expression:

if(Sum({<Qlikdate4={'Mon'}>}NO_OF_TCKTS)/Sum(NO_OF_TCKTS)<0.02,1,0)

Any ideas?

Thanks

1 Solution

Accepted Solutions
gmenoutis
Partner - Creator II
Partner - Creator II

The rule of thumb is to have a single aggr(). I guess it would be something like:

Sum(Aggr(

if(Sum({<Qlikdate4={'Mon'}>}NO_OF_TCKTS)/Sum(NO_OF_TCKTS)<0.02,1,0)

,WOFY,State,Store,Department))

View solution in original post

3 Replies
bharathadde
Creator II
Creator II

Try to create a flag in the script like below

if(Sum(if(Qlikdate4='Mon',NO_OF_TCKTS))/Sum(NO_OF_TCKTS)<0.02,1,0) as flag

then use this as expression

Aggr(Sum(if(flag=1,1,0)),WOFY,State,Store,Department)

gmenoutis
Partner - Creator II
Partner - Creator II

The rule of thumb is to have a single aggr(). I guess it would be something like:

Sum(Aggr(

if(Sum({<Qlikdate4={'Mon'}>}NO_OF_TCKTS)/Sum(NO_OF_TCKTS)<0.02,1,0)

,WOFY,State,Store,Department))

shamitshah
Partner - Creator
Partner - Creator
Author

Thanks.