Rolling 12 months total using DAX formula

Kane_Heramb

New Member
Joined
Feb 19, 2023
Messages
1
Office Version
  1. 2021
  2. 2019
  3. 2016
Platform
  1. Windows
Hi,
I am trying to calculate rolling 12 months total of the leavers using the DAX formula in power pivot. I am using is -
'Rolling 12M Leavers' =CALCULATE(COUNT(Exit_Base_Data[Leavers]),DATESINPERIOD(Exit_Base_Data[Leaving month],MAX(Exit_Base_Data[Leaving month]),-12,MONTH))

where Exit_Base_Data is a list of leavers, column [Leavers] is a flag/counter and column [Leaving month] is the month in which person has left. In pivot I also have few additional filters like Gender, leaving to external entity or internal movement etc.

The above formula works fine and provides the 12 month rolling total of leavers. Only problem is for the month when there is no leaver that meets the filtering criteria, the rolling total disappears for that particular month.
e.g. If I am looking at Female leavers for past 12 months

MonthActual Leavers12 month Rolling total leavers.
(Assuming prior to Jan there are zero leavers)
Jan11
Feb23
Mar3
Apr47
May29
Jun110
Jul414
Aug721
Sep21
Oct21
Nov324
Dec125

So, for Mar, Sep and Oct - the measure 'Rolling 12M Leavers' did not return anything, for rest of the months, it returns the correct 12 month rolling total.
Anyway to fix this? I also tried using 'Calendar' table

'Rolling 12M Leavers' =CALCULATE(COUNT(Exit_Base_Data[Leavers]),DATESINPERIOD('Calendar'[month],MAX('Calendar'[month]),-12,MONTH))

But this one returns the monthly number (the actual leavers column) and not the 12 month rolling.

Any suggesions?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top