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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

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