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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
Maria929292
Frequent Visitor

Employee Turnover monthly and to-date

Hi!

I am looking to DAX for the employee turnover calculated monthly.

The logic is (number of employess who left the company from the beginning of the period till the end of every month) / (avarage number of active employees from the beginning of the period till the end of every month)

where Average number of active employees is (sum of number of employess daily) / (number of days in the period):

e.g. Jan 1 - 20 employees

       Jan 2 - 25 employees 

       ....

      Jan 31 - 18 emloyees

Then (20+25+...+18)/31 day = average number of active employees

 

Employee turnover monthly DAX I need:

Since Jan 1 till Jan 31 there are 2 employees left and average number of active employees is say 23 then 2/23 = 8.7%

Then the next value should be calculated for the period since Jan 1 till Feb 28, then Jan 1 till March 31 etc.

 

The query looks like this:

First_Last_Name_EmployeeEmployment_start_date
Employment_end_date
Employee 101/03/201931/05/2019
Employee 217/11/201917/02/2020
Employee 301/10/201831/07/2020

 

Help would be greatly appreciated!

Maria

 

1 ACCEPTED SOLUTION

Hi @Maria929292 ,

First, please create a Date table. Then create a measure as below and put the date field of Date table in X axis of visual.

employees_left =
CALCULATE (
    DISTINCTCOUNT ( Staff_data[Email] ),
    FILTER (
        'Staff_data',
        Staff_data[Employment_start_date] <= SELECTEDVALUE ( 'Date'[date] )
            && Staff_data[Employment_end_date] >= SELECTEDVALUE ( 'Date'[date] )
    )
)

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Maria929292 , Refer my HR Blog

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

For Avg Employee

AverageX(values(Date[Date]),[Current Employees]) // ,[Current Employees]) from blog

 

In case of view by month year it should take care days

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

hi @amitchandak,

thank you so much for your help!

 


The employee calculations do not really work for me as I assign the labels depending on the year I am looking at. E.g. employee hired last year would be "hired" in 2020 and "current" in 2021.


This is my DAX for terminated employees (our fiscal year starts in September):

employees_left_in 20_21 = IF(

ISBLANK(CALCULATE(DISTINCTCOUNT(Staff_data[Email]),Staff_data[Employment_end_date]>=DATE(2020,09,01))),

0,

CALCULATE(DISTINCTCOUNT(Staff_data[Email]),Staff_data[Employment_end_date]>=DATE(2020,09,01)))


And the turnover I need should be within every year as well. 😞

Hi @Maria929292 ,

First, please create a Date table. Then create a measure as below and put the date field of Date table in X axis of visual.

employees_left =
CALCULATE (
    DISTINCTCOUNT ( Staff_data[Email] ),
    FILTER (
        'Staff_data',
        Staff_data[Employment_start_date] <= SELECTEDVALUE ( 'Date'[date] )
            && Staff_data[Employment_end_date] >= SELECTEDVALUE ( 'Date'[date] )
    )
)

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

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.