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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I get the previous MonthYear on a chart?

Thank you for helping me get the current MonthYear on the chart. I thought that getting the previous MonthYear would be quite straighforward once getting the current one was established, but it isn't.

It is the MonthYear from one year ago that I'm trying to get and I'm putting it in the second column of the aggr pivot table next to the current MonthYear.

I have managed to get the previous MonthYear to show in a text box, but if I put that exact formula inside quotes in the expression then I just get zeroes.

I can't figure out why this isn't working. Anybody know why?

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

Apart from a couple of syntax errors, you also have to undo the Year and Month filters, to have values for the last year in your expression. Try this one:

sum({$<MonthYear = {'$(=Date(monthstart(max(Date)-365), 'MMM-YYYY'))'}, Year=, Month=>} LineSalesAmount)

Juan Gerardo

View solution in original post

4 Replies
sujeetsingh
Master III
Master III

Inthe text box you can get previous month as

=(Date(monthstart(max(Date)-365) -1, 'MMM-YYYY') )


Not applicable
Author

The text box gives me what I want no problem, it's the expression in the chart where I can't get it to work.

Not applicable
Author

Apart from a couple of syntax errors, you also have to undo the Year and Month filters, to have values for the last year in your expression. Try this one:

sum({$<MonthYear = {'$(=Date(monthstart(max(Date)-365), 'MMM-YYYY'))'}, Year=, Month=>} LineSalesAmount)

Juan Gerardo

Not applicable
Author

Thank you, it works.