Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
mossandon
Contributor II
Contributor II

Previous three months

Hi friends,

I need to show sales for the three previous months to the selected month,

In the example show a month earlier, but do not know how to show the other two previous months.

I appreciate your help.

Thx in advance

13 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

What output you are looking for and what you are getting.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
jagan
Luminary Alumni
Luminary Alumni

HI,

In that case you need to create four expressions one for each month.

Regards,

jagan.

sunny_talwar

Here you go. Back to straight table with 4 expressions and 1 dimension:

Capture.PNG

Expressions

1) sum({$<Year, Month, Date = {"$(='>=' & Date(MonthStart(Max(Date))) & '<=' & Date(MonthEnd(Max(Date))))"}>} Sales)

2) sum({$<Year, Month, Date = {"$(='>=' & Date(MonthStart(Max(Date), -1)) & '<=' & Date(MonthEnd(Max(Date), -1)))"}>} Sales)

3) sum({$<Year, Month, Date = {"$(='>=' & Date(MonthStart(Max(Date), -2)) & '<=' & Date(MonthEnd(Max(Date), -2)))"}>} Sales)

4) sum({$<Year, Month, Date = {"$(='>=' & Date(MonthStart(Max(Date), -3)) & '<=' & Date(MonthEnd(Max(Date), -3)))"}>} Sales)

mossandon
Contributor II
Contributor II
Author

Many thanks Sunny T.

Your help will allow me to continue learning about this powerful tool.

And thanks to all who helped.

Regards

Mauricio