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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
suvechha_b
Creator III
Creator III

How to write the between expression ?

Hi All ,

How to get the sum of sales amount for previous 3 months ?

It needs to be flexible , if fiscal year , fiscal period is selected , then the sales should be calulated on the selected value. else max period of sales.

sample model attached.

Capture.PNG

10 Replies
rahulpawarb
Specialist III
Specialist III

Hello Suveccha,

After examining the shared expression, I found that true part of if statement requires changes in Higher Bound and Lower Bound values (Changed condition as - period_key less than equal to vMaxPrev3 and greater than equal to vPeriodKeyPrev).

if( not GetSelectedCount([Fiscal_Year]) or  not GetSelectedCount([Month]),

Sum({<[Fiscal_Year]=,[Month]=,period_key={"<=$(vMaxPrev3)>=$(vPeriodKeyPrev)"},TranType={$(vAmountType)}>}Amount),

Sum({<[Fiscal_Year]=,[Month]=,period_key={"<=$(vSelectMaxPrev3)>=$(vSelectMaxPrev1)"},TranType={$(vAmountType)}>}Amount))

Hope this will be helpful.

Regards!

Rahul