Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to get sum of sales for past 3 months for selected date.
but in my expression AddMonths() is not working properly.
sum({$<RPT_DT={">=$(=Addmonths(RPT_DT,-3)) <$(=RPT_DT)" }>}Sales)
Here Report date is in Timestamp format like 7/1/2014 12:00:00 AM
I am using below expression also. but i didn't get
sum({$<RPT_DT={">=$(=Addmonths(=Date(RPT_DT,'MM/DD/YYYY'),-3)) <$(=RPT_DT)" }>}Sales)
Here I am getting data for all the previous months for selected date for both expressions but i want only for past 3 months
can anyone help me
Thanks in Advance.
Muni
create month field in calendar and see this link
https://community.qlik.com/message/36589#36589
Vikas
Hi Muni:
Can you please try the following expression
sum({$<RPT_DT={">=$(=Addmonths(Max(RPT_DT),-3)) <$(=Max(RPT_DT))" }>}Sales)
Ahammad Shafi
First Convert the Report Date to date format without time in script like below
Data:
LOAD *,
Report_Date,
date(floor(Report_Date),'DD-MM-YYYY') as Date
FROM table
Now use below expression
sum({$<Date={">=$(=Addmonths(max(Date),-3)) <=$(=max(Date))"}>}Sales)