Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
valishaik1985
Contributor
Contributor

Write a condition using flags in Qliksense

I have fields like Sales is measure and 3 dimensions are User, month & Quarter.

My requirement is find the sum of sales  are >= 10 for each month(Jan, Feb, Mar) (Apr, May, Jun)so on, if any month in any Quarter not reach target user not eligible for entire Quarter ". If continuously eligible see below statement, both should be implemented.

Note: Stakeholders check Quarterly, but we needs to use monthly

Ex: Jan, Feb, Mar

       10, 10, 10    -----------> User Eligible this Quarter

        10, 10, 00  OR 10, 01, 01 ---------------> Not eligible This Quarter

until December write expression.

If continuously eligible for each quarter should be the below statement. 

REQUIREMENT:

IF       jan, feb, mar >= 10+10+10=30 eligible for promo  Other wise not eligible promo

           Apr, May, Jun >= 10+10+10=30 eligible for double promo Other wise not eligible promo

          Jul, Aug, Sep >= 10+10+10=30 eligible for Tripple promo Other wise not eligible promo

          Oct, Nov, Dec >= 10+10+10=30 eligible for Tripple promo+Cashback Other wise not eligible promo

Labels (1)
6 Replies
Or
MVP
MVP

Should be able to do something like if(Min(Aggr(Sum(Sales),Use, month,Quarter))>10,'Eligible','Not Eligible'), I think

valishaik1985
Contributor
Contributor
Author

Hi Master,

Thank you for reply.

Not working, if write this same condition we are missing some flag conditions which are promotion, double promotion and tripple promotion+ cash.

 

Regards,

Khasim

Or
MVP
MVP

You can adapt the formula to whatever additional conditions you need, but that would be the gist of it. All it does is aggregate the sum of sales for each combination of Use, month, and Quarter, and then checks the minimum value for that aggregation. If the minimum is lower than 10, we have at least one month that doesn't qualify and as a result the whole line doesn't qualify.

valishaik1985
Contributor
Contributor
Author

Hi Master,

Thank you for your reply

If any Quarter qualify each months then Eligible other than not Eligible

If qualify up to Quarter2 frequently then eligible for double promo

If qualify up to Quarter3 frequently then eligible for Triple promo

If qualify up to Quarter4 frequently then eligible for Triple promo + Cashback

If any one Quarter Qualify( that means all 3 months) Eligible for promo, here two months qualified one month not qualified i.e, not eligible for promo and same as for all quarter

Or
MVP
MVP

"My requirement is find the sum of sales >= 10 for each month, if any month not reach target user not eligible for entire year."

That's what I was answering. If you'd like to see how many quarters are included within that test range, you could just count the number of distinct quarters, since eligibility would end as soon as one month wasn't up to the requirement based on the first statement. If that's not the case, I'm afraid I didn't understand your requirements.

 

valishaik1985
Contributor
Contributor
Author

Hi Master,

Appreciate your comments.

Sorry for the mistake, I understood your query.

Here is my requirement "find the sum of sales  are >= 10 for each month(Jan, Feb, Mar) (Apr, May, Jun)so on, if any month in any Quarter not reach target user not eligible for entire Quarter ". If continuously eligible see below statement, both should be implemented.

Example:

If continuously eligible for each quarter should be the below statement. 

IF       jan, feb, mar >= 10+10+10=30 eligible for promo  Other wise not eligible promo

           Apr, May, Jun >= 10+10+10=30 eligible for double promo Other wise not eligible promo

          Jul, Aug, Sep >= 10+10+10=30 eligible for Tripple promo Other wise not eligible promo

          Oct, Nov, Dec >= 10+10+10=30 eligible for Tripple promo+Cashback Other wise not eligible promo