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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Display data of current and previous 2 months

Hi Guys,

I have a report, to display data of current and previous 2 months. There is a selection of Month above the report, user can select the month and the data of that month and previous 2 months to be displayed.

I have a field Date_Skey as '20150101'

Please help.

2 Replies
sunny_talwar

Is Date_Skey read as date? If it is then you can try this (assuming your are doing Sum(Measure))

Sum({<Date_Skey = {"$(='>=' & Date(AddMonths(Max(Date_Skey), -2), 'YYYYMMDD') & '<=' & Date(Max(Date_Skey), 'YYYYMMDD'))"}>} Measure)

miguelbraga
Partner - Specialist III
Partner - Specialist III

Check this two articles:

Rolling N months

Calculating rolling n-period totals, averages or other aggregations

Best regards,

Data Architect MB