Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Binny3
Contributor
Contributor

Trend graph calculation for rolling 12 months

Hi ,

I just want to show rolling 12 months in graph when I select a particular month. It is working fine for all months except the latest month. When I select latest month my trend graph is showing rolling 11 months except latest month. But when I select any other month rolling 12 months are shown including selected month. 

Example: If I have data Apr 2017 to Jan 2019 if I select Jan 2019 graph is showing Feb 2018-Dec 2018 but not till Jan 2019

when I select Dec 2018 it showing Jan 2018 to Dec 2018 which is correct. The following is the formula I am using:

{<MyDatecol={"<=$(=MyDatecol)>=$(=date(addmonths(max(MyDatecol),-11),'DD-MMM-YYYY'))"}

Labels (1)
6 Replies
sunny_talwar

Can add this to a KPI object and see what this shows?

='>=' & Date(AddMonths(Max(MyDatecol), -11), 'DD-MMM-YYYY') & '<=' & Date(MyDatecol, 'DD-MMM-YYYY')
pradosh_thakur
Master II
Master II

{<MyDatecol={"<=$(=date(max(MyDatecol)))>=$(=date(addmonths(max(MyDatecol),-11),'DD-MMM-YYYY'))"}
Learning never stops.
Binny3
Contributor
Contributor
Author

I tried implementing the formula you posted but the issue now is it is working fine for latest month but not for the other months.

sunny_talwar

With date range do you see with this new expression?

Binny3
Contributor
Contributor
Author

Date range for?? Please explain it ...

sunny_talwar

In your response to Pradosh, you mentioned that this works for the latest month, but not for the other months. What date range do you see for other months? Why do you think it isn't working for other months?

Does that clarify my question?