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: 
Pomna
Creator III
Creator III

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
ManuelLindekeit
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

Pomna
Creator III
Creator III
Author

Thanks Manuel but it does not work

ManuelLindekeit
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.