Forum Discussion

Raman3456's avatar
Raman3456
Icon for Helper II rankHelper II
1 year ago

HR Attrition Rate DAX

Hello Folks ,

 

Hope you all are doing well .

 

I have been stucked from past 3 days , I need to calculate the HR Attrition  and Attrition percentage based on the data .

 

here is the below data like 

 

UserID, Name , Date of joinig , department .............Here i should have to find two columns .... Present in last month .. Present in currrent month ............

 

Please check and let me know .

 

 

Regards,

Raman

5 Replies

  • 123abc's avatar
    123abc
    Icon for Community Champion rankCommunity Champion

    First  Calculate the Number of Employees Present in the Last Month:

    Employees_Last_Month = 
    CALCULATE(
        COUNTROWS('EmployeeTable'),
        FILTER(
            'EmployeeTable',
            'EmployeeTable'[Date of Joining] <= EOMONTH(TODAY(), -1) &&
            (ISBLANK('EmployeeTable'[Termination Date]) || 'EmployeeTable'[Termination Date] > EOMONTH(TODAY(), -1))
        )
    )

    Second Calculate the Number of Employees Present in the Current Month:

    Employees_Current_Month = 
    CALCULATE(
        COUNTROWS('EmployeeTable'),
        FILTER(
            'EmployeeTable',
            'EmployeeTable'[Date of Joining] <= EOMONTH(TODAY(), 0) &&
            (ISBLANK('EmployeeTable'[Termination Date]) || 'EmployeeTable'[Termination Date] > EOMONTH(TODAY(), 0))
        )
    )

     Third Calculate the Attrition Rate:

    Attrition_Rate = 
    DIVIDE(
        CALCULATE(
            COUNTROWS('EmployeeTable'),
            FILTER(
                'EmployeeTable',
                'EmployeeTable'[Termination Date] >= EOMONTH(TODAY(), -1) &&
                'EmployeeTable'[Termination Date] <= EOMONTH(TODAY(), 0)
            )
        ),
        Employees_Last_Month,
        0
    )

    Final   Calculate the Attrition Percentage:

    Attrition_Percentage = 
    [Attrition_Rate] * 100

    These measures should help you calculate the HR Attrition Rate and Attrition Percentage based on your data. If you need further assistance or have any questions, feel free to ask! 😊

     

    Also Follow Given Link:

    Calculating Employee Attrition Rate with DAX – Part 1

    Solved: Attrition DAX for HR Dashboard - Microsoft Fabric Community

    Calculating Staff Turnover with DAX in Power BI | HR Insight...

    YouTube

     

    Furthermore :

    You can also share your sample pbix file with non senstive data for more help.

     

     

     

    • Raman3456's avatar
      Raman3456
      Icon for Helper II rankHelper II

      Hi thank you 123abc. I have only 2 columns existed in my data ,

       

      Date , User ID , there is no termination date and status also here .

       

       

      Dateuser ID
      2023-05-03HDG4656
      2023-06-02HJIK9736
      2024-07-03OJIK9873
      2024-08-04HJIK9736
      • ryan_mayu's avatar
        ryan_mayu
        Icon for Super User rankSuper User

        what's the expected output based on the sample data you provided?