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: 
Not applicable

Expression for Rolling 12 Month Count ignoring Month Dimension.

Hey guys,

I've been working on a table that will be converted into one of our dashboards for some safety statistics and I'm stuck attempting to create a rolling 12 month calculation, I'm sure i've done something similar before but search and previous reports yeild no answers as yet.

I've simplified this a fair bit to get the expression working so I can apply it to other things like TRIFR etc. The basic table structure is essentially Month Year (MMM-YYYY) as a dimension and Count([Injury ID]) as an expression:

Month# Injuries
Jul-201212
Aug-201218
Sep-20128
Oct-20127

Then I need to count those injuries over a 12 month period (The Month of the line and up to 12 months before). Ideally the result will look like:

Month# InjuriesRolling 12 Month
Jul-20121212
Aug-20121830
Sep-2012838
Oct-2012745
Nov-2012651
Dec-20121263
Jan-2013972
Feb-2013981
Mar-20131091
Apr-2013798
May-20134102
Jun-20139111
Jul-201319118
Aug-20135105

I believe I need the expression to ignore the Month dimension, and then use set analysis to select where the Month is greater thanor equal to AddMonths(Month, -12) and less than or equal to Month. However I'm not sure how to achieve this.

using TOTAL in my calculation seems to ignore my set analysis: ie:

=Count(TOTAL {<[MTH YR]={'>=$(AddMonths([MTH YR], -12))'}>} [Injury ID])

same result with =Count(TOTAL <[MTH YR]> {<[MTH YR]={'>=$(AddMonths([MTH YR], -12))'}>} [Injury ID])

Any help would be appreciated, thankyou.

2 Replies
Anonymous
Not applicable
Author

Please look into the attached file.

I think this is required by you.

Regards

Nitin

Not applicable
Author

Thanks for replying nitin, while this works on an unfiltered report I've avoided using Above as the dashboard will likely be filtered down to the range of several months by the users and Above will give what they perceive to be incorrect results in that situation.