Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Partner
Partner

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
Partner
Partner

Re: Set Analysis - Aggr Function with If statement

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
Highlighted
bharathadde
Contributor II

Re: Set Analysis - Aggr Function with If statement

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)

Partner
Partner

Re: Set Analysis - Aggr Function with If statement

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

Partner
Partner

Re: Set Analysis - Aggr Function with If statement

Thanks.