Forum Discussion

mirmo's avatar
mirmo
New Member
1 year ago
Solved

Turnover over years

Hi there!

I have information of 5 key talent pools over 4 years and I will like to calculate the turnover between years, for example if the year selected is 2025 I would like to see how many employees that where HP 2024 still are HP in 2025, when 2024 is sleected I would like to see the turnover respect 2023, etc.

 

  • Hi mirmo   ,
    Thanks for reaching out to the Microsoft fabric community forum. 

    1. Created sample data based on your inputs.

     

    2. Created DAX measure "HP Turnover %" with below code.

     

    HP Turnover % = 
    VAR SelectedYear = MAX(TalentData[Year])
    VAR PrevYear = SelectedYear - 1

     

     

    VAR PrevHP =
        FILTER(
            TalentData,
            TalentData[Year] = PrevYear &&
            TalentData[KTP] = "HP"
        )

     

    VAR PrevHP_IDs = SELECTCOLUMNS(PrevHP, "ID", TalentData[ID])

     

    existed in HP last year
    VAR StillHP =
        FILTER(
            TalentData,
            TalentData[Year] = SelectedYear &&
            TalentData[KTP] = "HP" &&
            TalentData[ID] IN PrevHP_IDs
        )

     

    VAR Retained = COUNTROWS(StillHP)
    VAR TotalPrev = COUNTROWS(PrevHP)

     

    RETURN
    IF(
        TotalPrev = 0,
        BLANK(),
        FORMAT(1 - DIVIDE(Retained, TotalPrev), "0.0%")
    )

     

    3. Created a Year slicer based on TalentData[Year]. Add a Card visual for the HP Turnover % measure.

     

    4. Please refer the attached PBIX file for your reference.


    If this post helps then please mark it as a solution, so that other members find it more quickly. 

    Thank you.

11 Replies

  • Sounds good. Would you want to use a Sankey chart visual for that? 

     

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.

    Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

  • mirmo's avatar
    mirmo
    New Member

    thanks for the Reply! here is an example of the data I have, what I need is to calculate the Turnover %

     

    IDYearIdYearKTP    
    1202512025HP    
    2202522025HP   Turnover
    3202532025HP KTP 2025366%
    1202412024HP KTP 20241100%
    2202422024NO KTP 20232N/A
    3202432024NO    
    1202312023NO    
    2202322023HP    
    3202332023HP    
    • lbendlin's avatar
      lbendlin
      Icon for Super User rankSuper User

      That's a bit of a fallacy as you don't know if these turnovers are caused by the same or different people. Better to use a chart by user.

       

       

      • mirmo's avatar
        mirmo
        New Member

        I need to control of there a variations of the ID employees on each pool

  • Hi mirmo ,

     

    To calculate year-over-year turnover for key talent pools in Power BI, you need a table that includes at least EmployeeID, Year, and TalentPool. The goal is to determine how many employees remained in the same pool from one year to the next, such as how many employees in the HP category in 2024 are still in HP in 2025. This is a retention calculation. To get started, you can create a DAX measure called HP Retention that dynamically checks the selected year and compares it to the previous year.

    HP Retention = 
    VAR SelectedYear = MAX('Calendar'[Year])
    VAR PreviousYear = SelectedYear - 1
    
    VAR HP_LastYear = 
        FILTER(
            'TalentData',
            'TalentData'[Year] = PreviousYear &&
            'TalentData'[TalentPool] = "HP"
        )
    
    VAR HP_ThisYear = 
        FILTER(
            'TalentData',
            'TalentData'[Year] = SelectedYear &&
            'TalentData'[TalentPool] = "HP"
        )
    
    RETURN
    CALCULATE(
        COUNTROWS(HP_LastYear),
        INTERSECT(
            SELECTCOLUMNS(HP_LastYear, "EmployeeID", 'TalentData'[EmployeeID]),
            SELECTCOLUMNS(HP_ThisYear, "EmployeeID", 'TalentData'[EmployeeID])
        )
    )
    

    To calculate the turnover, you can create another measure called HP Turnover by subtracting the retained count from the total HP population in the previous year.

    HP Turnover = 
    VAR SelectedYear = MAX('Calendar'[Year])
    VAR PreviousYear = SelectedYear - 1
    
    VAR Total_HP_LastYear = 
        CALCULATE(
            COUNTROWS('TalentData'),
            'TalentData'[Year] = PreviousYear,
            'TalentData'[TalentPool] = "HP"
        )
    
    RETURN
    Total_HP_LastYear - [HP Retention]
    

    This setup will allow your report to dynamically show the number of employees retained or lost from the HP pool, depending on the year selected in the slicer. You can replicate this logic for other talent pool categories by changing "HP" to the desired pool or making it a variable based on user selection.

     

    Best regards,

    • v-menakakota's avatar
      v-menakakota
      Icon for Community Support rankCommunity Support

      Hi mirmo ,

      May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster. Can you please provide sample data.

      Thank you.

       

      • v-menakakota's avatar
        v-menakakota
        Icon for Community Support rankCommunity Support

        Hi mirmo ,

        May I ask if you have resolved this issue? Can you please update on this issue.

         

        Thank you.

    • v-menakakota's avatar
      v-menakakota
      Icon for Community Support rankCommunity Support

      Hi mirmo   ,
      Thanks for reaching out to the Microsoft fabric community forum. 

      1. Created sample data based on your inputs.

       

      2. Created DAX measure "HP Turnover %" with below code.

       

      HP Turnover % = 
      VAR SelectedYear = MAX(TalentData[Year])
      VAR PrevYear = SelectedYear - 1

       

       

      VAR PrevHP =
          FILTER(
              TalentData,
              TalentData[Year] = PrevYear &&
              TalentData[KTP] = "HP"
          )

       

      VAR PrevHP_IDs = SELECTCOLUMNS(PrevHP, "ID", TalentData[ID])

       

      existed in HP last year
      VAR StillHP =
          FILTER(
              TalentData,
              TalentData[Year] = SelectedYear &&
              TalentData[KTP] = "HP" &&
              TalentData[ID] IN PrevHP_IDs
          )

       

      VAR Retained = COUNTROWS(StillHP)
      VAR TotalPrev = COUNTROWS(PrevHP)

       

      RETURN
      IF(
          TotalPrev = 0,
          BLANK(),
          FORMAT(1 - DIVIDE(Retained, TotalPrev), "0.0%")
      )

       

      3. Created a Year slicer based on TalentData[Year]. Add a Card visual for the HP Turnover % measure.

       

      4. Please refer the attached PBIX file for your reference.


      If this post helps then please mark it as a solution, so that other members find it more quickly. 

      Thank you.

    • v-menakakota's avatar
      v-menakakota
      Icon for Community Support rankCommunity Support

      Hi  mirmo ,

      May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster. 

       

      Thank you.