Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
microwin88x
Creator III
Creator III

Rolling Last 12 Months

Hello,

I have an expression that displays a KPI for the last 12 months like this:

SUM({$<ACC_DATE={">=$(=MONTHSTART(MAX(ACC_DATE),-11))<=$(=MAX(ACC_DATE)-1)"}>}AMOUNT)

So that means I get the AMOUNT between April 2016 and March 2017.

    I need to see the data until the last month is closed, that's why I don't consider the current month, April 2017.

The thing is that if I select Year = 2016, it shows me from January 2016 to November 2016 (without December 2016).

What I would need is to show the following:

- At the beginning: Last 12 months (without current month).

- If I select a year: The corresponding period (from Jan to Dec).

- If I select a year and a month: The data for that month only.

- If I select a year and N months: The data for those months only.

Do you know how could I handle this?

Thank you!

3 Replies
Anonymous
Not applicable

Please dont create duplicate threads. Rolling Last 12 Months

MK9885
Master II
Master II

Maybe this one?

If (GetSelectedCount ([Year]) = 0 , SUM({$<ACC_DATE,[Rolling 12]={1}>}AMOUNT), If (GetSelectedCount ([Year List]) > 0 , SUM({$<ACC_DATE,[Last Year Flag]={1} >+< [Month]>0}AMOUNT)

I'm not sure if this will work?

[Rolling 12] field is defined in Master Calendar to only show last 12 month from current date.

Below is the code to be used in Master Calendar...


[Rolling 12]:

  If( TempDate > monthstart(addmonths(today(),-11)) and TempDate <= Today(),1)as [Rolling 12],


Last Year Flag:  if(InYear(TempDate, today(),-1), 1, 0) as LastYearFlag,



I guess if you provide a sample data it would be more easy or perhaps someone with expertise level can help you here?


Anonymous
Not applicable

Hi

I think you are looking for this:

- At the beginning: Last 12 months (without current month).

Capture1.PNG

- If I select a year: The corresponding period (from Jan to Dec).

Capture2.PNG

- If I select a year and a month: The data for that month only.

Capture3.PNG

- If I select a year and N months: The data for those months only.

Capture4.PNG

The app is attached below respective to the above screen shots.

Hope you will find your expected answer.