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

Please help me with the error below.

  I am getting an error with the below if statement.

if(DEP_ACCT_OPN_DT >= $(CurrentMonth) and DEP_ACCT_OPN_DT <= $(PreviousMonth)) as FirstMonth,

Note :CurrentMonth is a variable with value set as

date(floor(monthstart(Today()))) .

Many Thanks

11 Replies
MayilVahanan

Hi

Try like this

if(DEP_ACCT_OPN_DT >= Date(floor(monthstart(Today()))) and DEP_ACCT_OPN_DT <= Date(floor(MonthEnd(Today()))), 'CurrentMonth',

if(DEP_ACCT_OPN_DT >= Date(floor(monthstart(Today(),-1))) and DEP_ACCT_OPN_DT <= Date(floor(MonthEnd(Today(),-1))),'PreviousMonth',

if(DEP_ACCT_OPN_DT >= Date(floor(monthstart(Today(),-2))) and DEP_ACCT_OPN_DT <= Date(floor(MonthEnd(Today(),-2))), 'PREPreviousMonth'))) as Bucket

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thank you very much for all your help.It did work.Thanks !