Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression to view previous month data not working

Hi guys,

In my load statement I have

    "Date",

    Month(Date) as "Month",

    Year(Date) as "Year",

    Date(MonthStart(Date), 'MMM-YY') as MonthYear,

    Price

Which works fine. And when I want to view the max MonthYear selected with the expression:

Sum({<MonthYear = {"$(=max(MonthYear))"}>}Price)

That works fine for whichever MonthYear I select. However when I try the expression:

Sum({<MonthYear = {"$(=max(MonthYear)-1)"}>}Price)

It never seems to work as it only returns 0. My max MonthYear is Jan-15, so one before would be Dec-14. Can anyone see what I'm doing wrong? I'm not too good when it comes to this stuff so please let me know if something else doesn't look right.

Thanks in advance.

Also I'm not able to post the file, sorry!

11 Replies
ToniKautto
Employee
Employee

Always a bit tricky predicting a good solution without a sample.

EDIT: My bad, I provided a QlikView file. Attached is instead a Qlik Sense file.

Not applicable
Author

I found an expression on another discussion which seems to be working for me after some modification.

Sum({<MonthYear={"$(=Date(MonthEnd(Max(MonthYear),-1),'MMM-YY'))"} >}Price)

But I'll have a look at that also. Thanks for the help!