Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
MatiasM
Frequent Visitor

Problem with Rolling 12 month turnover DAX

Hi Community,

 

I hope you can help with this query.

I'm trying to get the rolling 12 month data of turnover in my Company. The formula seems to be working fine when I don't filter by specific months (see below)

 

 

Turnover (% Rolling 12 months) =
    CALCULATE (
        [Turnover (%)],
        DATESINPERIOD ( Overall[Last Day of Duty], MAX(Overall[Last Day of Duty]), -12, MONTH )
    ) / 12 // 12 months ending at the end of the current filtered month
 
Turnover % is the filtering formula that I use to get the right population=
 
Turnover % =
VAR FormulaTurnover =
    CALCULATE (
    DISTINCTCOUNT(Overall[Staff Member]),
        Overall[Termination Reason] IN {"RESIGNATION","RETIREMENT"}
    // Overall[Termination Reason] = "RESIGNATION" || Overall[Termination Reason] = "RETIREMENT"
    // OR (  Overall[Termination Reason] = "RESIGNATION" , Overall[Termination Reason] = "RETIREMENT")
    )
RETURN
DIVIDE ( FormulaTurnover, DISTINCTCOUNT ( Overall[Staff Member] ) )

The challenge is when I try to filter by a specific month where I don't have any people leaving the company which means =
If Turnover % for a specific month is 0 then rolling 12 month returns 0. This is not what I need because, regardless of having one month with no records I still have the previous months with data.

 
I hope I'm clear with what I need, let me know if you require further information
 
Thanks in advance
 
Matias
 
1 REPLY 1
ThxAlot
Super User
Super User

No instructive help can be offered without concrete mock-up dataset. But generally speaking, a standard calendar table helps avoid quite some pitfalls when time intelligence functions are used (eg  DATESINPERIOD ( Overall[Last Day of Duty], MAX(Overall[Last Day of Duty]), -12, MONTH ) in your case); in fact, here both MAX() and DATESINPERIOD() are subject to current filter context.



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LeanAndPractise(Everyday)


)



Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors