Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Last 13 Months

Hello everyone,

I need to show last 13 months data excluding current month. That is,  April 2019 to April 2020. but I get May 2019 to May 2020. Below is my script. How do I amend it to read April 2019 to April 2020?

If( "Canonical Date" - YearStart("Canonical Date") <= Today() - YearStart(Today()), 1, 0 ) as IsInYTD,

If( "Canonical Date"> monthstart(addmonths(today()-1,-12)) and "Canonical Date"<= today(),1,0) AS Rolling13Months

3 Replies
Highlighted
Contributor III
Contributor III

Hi, 

I would add this in your calendar table:

if([Date] >= date(monthstart(addmonths(today(),-13))) and [Date] < date(monthstart(addmonths(today(),-0))), 'Y', 'N') AS Is13MonthsDate

Highlighted
Creator II
Creator II

Thanks Manuel but it does not work

Highlighted
Contributor III
Contributor III

In which way does it not work? If you add to your master calendar as a flag it should mark the timeframe you need and then you can use the flag in your set analysis. Let me know and I can take a look again.