Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis help.

How can I write this in set analysis.

 

=Sum(if(ActualAccount<>0,
if([Miscellenious Fee]<>0,
year=, Month=, Date='>=$(=MonthStart(Max(Date), -1))<=$(=MonthEnd(Max(Date), -1))'),FeeAmount)))

I am calculating the previous month feeamount if ActualAccount <> 0 and if Miscellenious Fee <>0.

Thanks.

3 Replies
MK_QSL
MVP
MVP

SUM({$<

     ActualAccount -= {0},

     [Miscellenious Fee] -= {0},

     Year =, Month=,

     Date = {">=$(=MonthStart(Max(Date)),-1) <= $(=MonthEnd(Max(Date)),-1)"}

>}FeeAmount)

Not applicable
Author

hi

SUM({$< ActualAccount -= {0}, [Miscellenious Fee] -= {0}, Year =, Month=, Date = {">=$(=MonthStart(Max(Date)),-1) <= $(=MonthEnd(Max(Date)),-1)"}>}FeeAmount)

tabletuner
Creator III
Creator III


Hi Aptha0115, keep in mind that the if statements will include your null values. However, the set analysis will always exclude them because they cannot be selected. To correct the behaviour you should insert statements in your load script like:

if(isnull(ActualAccount),0,ActualAccount)     AS ActualAccount,

if(isnull([Miscellenious Fee]),0,[Miscellenious Fee])     AS [Miscellenious Fee]