Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rewrite IF statement using Set Analyzes

Hi All.

I need to rewrite following expression to replace IF condition with set expression, but have no idea, how.

if(

  count({$<Year=,Month=,_Date={">$(=Date(AddMonths(MonthStart(max(_Date))-1,-3)))<$(=Date(AddMonths(MonthStart(max(_Date)),0)))"},Flag={1}>

  }  Id_Month)

  =

  count({$<Year=,Month=,_Date={">$(=Date(AddMonths(MonthStart(max(_Date))-1,-3)))<$(=Date(AddMonths(MonthStart(max(_Date)),0)))"}>

  }  Id_Month)

  ,

  sum({$<Year=,Month=,_Date={">$(=Date(AddMonths(MonthStart(max(_Date))-1,-3)))<$(=Date(AddMonths(MonthStart(max(_Date)),0)))"}>

  *<Year=,Month=,RestQty={'>0'}>

  }  Sales)

  ,Null()

)

The goal of expression:

Get sum of Sales for last 3 monthes, where Current Rests Quantity >0 and only if count of monthes with Flag=1 equals count of monthes with sales.

Any help with my issue will be greatly appreciated. Thanks in advance!

0 Replies