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: 
ruma_barman
Creator
Creator

Sum of previous sale not working with selection of one month

Hi All,

Can anybody please help?

I have an expression like

(sum({<Link_Date={'$(vMaxDate)'}>}Sales)-sum({<Link_Date={'$(vPreviousDate)'}>}Sales))/sum({<Link_Date={'$(vPreviousDate)'}>}Sales) where vMax and vPreviousDate are variables defined respectively as =Date(Max(Link_Date),'DD/MM/YYYY') and =Date(monthend(Addmonths(max(Link_Date),-1)),'DD/MM/YYYY').


This is working when no monthname is selected ,whenever one single month is selected it will show sum as 0 but will work when two month name is selected.



Thanks,

Ruma

5 Replies
sunny_talwar

What is your monthname field called? If it is called monthname, then try this

(Sum({<Link_Date={'$(vMaxDate)'}>}Sales) - Sum({<Link_Date={'$(vPreviousDate)'}, monthname>}Sales))/Sum({<Link_Date={'$(vPreviousDate)'}, monthname>}Sales)

ruma_barman
Creator
Creator
Author

Thanks Sunny.

Regards,

Ruma

ruma_barman
Creator
Creator
Author

Hi Sunny,

If I try with fiscal quarter year,it's not working.Is anything else I need to do?

(Sum({<Link_Date={">=$(=Date(QuarterStart(vMaxDate,0),'DD/MM/YYYY'))<=$(=Date(quarterEnd(vMaxDate,0),'DD/MM/YYYY'))"} >} Sales)

-

Sum({<[Fiscal Quarter Year], Link_Date={">=$(=Date(QuarterStart(vMaxDate,-1),'DD/MM/YYYY'))<=$(=Date(quarterEnd(vMaxDate,-1),'DD/MM/YYYY'))"} >}Sales))

/ Sum({<[Fiscal Quarter Year], Link_Date={">=$(=Date(QuarterStart(vMaxDate,-1),'DD/MM/YYYY'))<=$(=Date(quarterEnd(vMaxDate,-1),'DD/MM/YYYY'))"} >} Sales)

Regards,

Ruma

sunny_talwar

When you say it is not working, do you see inconsistent result? see errors?

ruma_barman
Creator
Creator
Author

Sorry for late reply.It's working fine now.

Thanks,

Ruma