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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Sam_BI_Analyst
Frequent Visitor

Employee Turnover and Retention Dax

Hello Community,

 

I need some guidance/help with calculating Employee Retention and turnover using DAX

 

Here's my data looks like - 

Sam_BI_Analyst_0-1722280903830.png

I will attach this data below.

 

I also created a Date table using the formula -> Date = CALENDAR( DATE(1,1,2016), DATE(12,31,2024))

 

My Requirement - 

I need two tables (one for turnover and one for retention) with all the years from 2016 to 2024 in power bi not in excel!!!

 

Sam_BI_Analyst_1-1722281210000.png

 

Sam_BI_Analyst_2-1722281229187.png

Note - While calculating starting headcount and ending headcount please include rehire as a record for counts, dont skip rehires.

 

Thanks in advance.

Data - 

 

Employee IDCompanyHire DateTermination DateImpact Reason
101Google7/4/2018 New Hire
101Google 8/8/2020Adv Oppurtunities
101Google10/8/2021 Re Hire
102Facebook3/15/2017 New Hire
102Facebook 6/21/2021Health
103Facebook2/14/2019 New Hire
104Google8/12/2018 New Hire
104Google 5/16/2020Child Care
105Google10/5/2018 New Hire
105Google 12/20/2018Adv Oppurtunities
105Google10/20/2021 Re Hire
105Google 5/12/2022Adv Oppurtunities
105Google2/12/2023 Re Hire

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @Sam_BI_Analyst -Hope you already have a relationship with Date table to Employee Table.

 

Create calculates the number of employees at the beginning of each year.

rajendraongole1_0-1722326746393.png

Starting Headcount =
VAR StartDate = MIN('Date'[Date])
RETURN
CALCULATE(
    COUNTROWS(Employee),
    FILTER(
        Employee,
        (Employee[Hire Date] <= StartDate &&
        (ISBLANK(Employee[Termination Date]) || Employee[Termination Date] > StartDate)) ||
        (Employee[Impact Reason] = "Re Hire" && Employee[Hire Date] <= StartDate)
    )
)
 
rajendraongole1_1-1722326790629.png

create another measure calculates the number of employees at the end of each year

Ending Headcount =
VAR EndDate = MAX('Date'[Date])
RETURN
CALCULATE(
    COUNTROWS(Employee),
    FILTER(
        Employee,
        (Employee[Hire Date] <= EndDate &&
        (ISBLANK(Employee[Termination Date]) || Employee[Termination Date] > EndDate)) ||
        (Employee[Impact Reason] = "Re Hire" && Employee[Hire Date] <= EndDate)
    )
)
 
Now create a turn over
Turnover =
CALCULATE(
    COUNTROWS(Employee),
    FILTER(
        Employee,
        Employee[Termination Date] >= MIN('Date'[Date]) &&
        Employee[Termination Date] <= MAX('Date'[Date])
    )
)
 
Retention Table =
SUMMARIZE(
'Date',
'Date'[Year],
"Starting Headcount", [Starting Headcount],
"Ending Headcount", [Ending Headcount],
"Retention Rate", DIVIDE([Ending Headcount], [Starting Headcount], 0)
)
 
create calculated tables as below for retention table:
Retention Table =
ADDCOLUMNS(
    VALUES('Date'[Year]),
    "Starting Headcount", [Starting Headcount],
    "Ending Headcount", [Ending Headcount],
    "Retention Rate", DIVIDE([Ending Headcount], [Starting Headcount], 0)
)
 
Turnover Table =
SUMMARIZE(
'Date',
'Date'[Year],
"Starting Headcount", [Starting Headcount],
"Turnover", [Turnover],
"Turnover Rate", DIVIDE([Turnover], [Starting Headcount], 0)
)
 
Hope it helps
 
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @Sam_BI_Analyst -Hope you already have a relationship with Date table to Employee Table.

 

Create calculates the number of employees at the beginning of each year.

rajendraongole1_0-1722326746393.png

Starting Headcount =
VAR StartDate = MIN('Date'[Date])
RETURN
CALCULATE(
    COUNTROWS(Employee),
    FILTER(
        Employee,
        (Employee[Hire Date] <= StartDate &&
        (ISBLANK(Employee[Termination Date]) || Employee[Termination Date] > StartDate)) ||
        (Employee[Impact Reason] = "Re Hire" && Employee[Hire Date] <= StartDate)
    )
)
 
rajendraongole1_1-1722326790629.png

create another measure calculates the number of employees at the end of each year

Ending Headcount =
VAR EndDate = MAX('Date'[Date])
RETURN
CALCULATE(
    COUNTROWS(Employee),
    FILTER(
        Employee,
        (Employee[Hire Date] <= EndDate &&
        (ISBLANK(Employee[Termination Date]) || Employee[Termination Date] > EndDate)) ||
        (Employee[Impact Reason] = "Re Hire" && Employee[Hire Date] <= EndDate)
    )
)
 
Now create a turn over
Turnover =
CALCULATE(
    COUNTROWS(Employee),
    FILTER(
        Employee,
        Employee[Termination Date] >= MIN('Date'[Date]) &&
        Employee[Termination Date] <= MAX('Date'[Date])
    )
)
 
Retention Table =
SUMMARIZE(
'Date',
'Date'[Year],
"Starting Headcount", [Starting Headcount],
"Ending Headcount", [Ending Headcount],
"Retention Rate", DIVIDE([Ending Headcount], [Starting Headcount], 0)
)
 
create calculated tables as below for retention table:
Retention Table =
ADDCOLUMNS(
    VALUES('Date'[Year]),
    "Starting Headcount", [Starting Headcount],
    "Ending Headcount", [Ending Headcount],
    "Retention Rate", DIVIDE([Ending Headcount], [Starting Headcount], 0)
)
 
Turnover Table =
SUMMARIZE(
'Date',
'Date'[Year],
"Starting Headcount", [Starting Headcount],
"Turnover", [Turnover],
"Turnover Rate", DIVIDE([Turnover], [Starting Headcount], 0)
)
 
Hope it helps
 
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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