I am trying to work out how long the average duration of employment for a group of employees across a large company is over time
I have a table called Current_Worker_Detail_Report
For employees still working here, EndDate is blank.
Each employee is present only once in the dataset.
I have a Date table called Calendar
I have this measure which calculates the number of staff employed on any day since the dataset begins and seems to work fine:
StaffCount =var CurrentDate= max('Calendar'[DATE])
DISTINCTCOUNT(Current_Worker_Detail_Report[Censhare Author Name]),Current_Worker_Detail_Report[Hire Date]<=CurrentDate, OR(ISBLANK(Current_Worker_Detail_Report[End date]),Current_Worker_Detail_Report[End date]>CurrentDate))
How do I go about calculating length of employment on an ongoing basis? DATEDIFF but then what I am using as EndDate as when I tried this with EndDate as Max(Calendar'Date'), the output over all time calculated the duration as ongoing until today (when the figure for Dec 2019 would be duration up to end of that month etc, and then January would be a month longer etc etc)
very grateful for any pointers
Hi @elegreen ,
Could you please share your sample data and expected result to me if you don't have any Confidential Information? Please upload your files to OneDrive for Business and share the link here.
I can't upload it but this is the premise
Made up sample data
MadeUp Ltd launched on 1/1/2019 with ten staff. Therefore the average duration of employment in Feb 19 was 1 month.
Then half the MadeUp team decided to leave all at the same time at the end of the year (traitors!) and the company hired five new staff to replace them. So the average length of employment was 11 months in December 2019, but fell to 6 months in January 2020 (5 people had 12 months duration and 5 people had 0)
So this but for a dataset of 12,000 people
Not sure I am following, generally, IF(ISBLANK([End Date]),TODAY(),[End Date]) or if you want till the end of the current month, IF(ISBLANK([End Date]),EOMONTH(TODAY(),0),End Date])
What I am hoping to get out is something like this - say we had lots of fairly longstanding staff suddenly leave in February and be replaced by brand new staff, the averageduration would decline in March
If I use TODAY as the EndDate, the average duration for previous time periods will be incorrect, I think? Because it would be calculating it to today, not until the end of the relevant month in the date column.
Does that make more sense?
thanks for your answer
Refer, if My HR blog can help
Click here to read more about the December 2021 Updates!
Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.
Mark your calendars and join us for our next Power BI Dev Camp!