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

Month over Month Report

For a Headcount and Attrition Analysis report, I need to calculate the Average Heacount for any given month as (current headcount + previous headcount)/2. I've created this expression to do that:

(sum({<[Employee_Non-Employee]={'Employee'}>}TurnoverPopulationFlag)) + (sum({1<YearMonth={"$(=(date(AddMonths(YearMonth,-1),'YYYYMM')))"},[Employee_Non-Employee]={'Employee'}>}TurnoverPopulationFlag)))/2

Performance Rating and YearMonth are Dimensions in the report. If a single YearMonth is selected, the calculation works fine However, if multiple YearMonth selections are made, the preious month calculation does not seem to work - (sum({1<YearMonth={"$(=(date(AddMonths(YearMonth,-1),'YYYYMM')))"},[Employee_Non-Employee]={'Employee'}>}TurnoverPopulationFlag))).

Any ideas why? Thanks.





2 Replies
Not applicable
Author

Hi,

you can create a variable to identifying the minimum or maximum value of the selected values in YearMonth field and make use of the variable in your expression.

Regards

Rajesh

Not applicable
Author

Thanks. Do you have an example of how this would be done?