Forum Discussion
Calculate Current Employee Count based on Joined and Leave Date
- 10 years ago
Anonymous
I tried to build the data model with the data you provided. The measures seemed to work well as below. I’ve uploaded my .pbix file here for reference. Could you please take a look at it to see if there is any difference?
Best Regards,
Herbert
Anonymous
I tried to build the data model with the data you provided. The measures seemed to work well as below. I’ve uploaded my .pbix file here for reference. Could you please take a look at it to see if there is any difference?
Best Regards,
Herbert
Hello v-haibl-msft,
Your answer made me understand a lot of thing in PBI ! Thanks a lot !
Still, I struggled a lot with the leaving data on my dataset. There were wrong compared to manual Excel filtering count.
I found why and thought I would share to help someone like me around :)
Per example, for 2016, I only get leaving people of 2016 when they arrived also in 2016! I was missing all other leaves.
I then change the "leaving" measure into a similar code as "joining" which was giving correct numbers.
I used the relation of Date<=>EmployeeDB[Leaving Date] instead of "Arrival". that make much sense and is probably root of wrong calculation.
Leaving =
IF (
CALCULATE (
COUNT ( EmployeeDB[Leaving Date] );
USERELATIONSHIP ( DateD2[Date]; EmployeeDB[Leaving Date] );
ALL ( EmployeeDB[Leaving Reason] )
)
= BLANK ();
0;
CALCULATE (
COUNT ( EmployeeDB[Leaving Date] );
USERELATIONSHIP ( DateD2[Date]; EmployeeDB[Leaving Date] );
ALL ( EmployeeDB[Leaving Reason] )
)
)
Hope that will help someone someday.
Tim Mayle.
- Anonymous8 years agoNot applicable
This was really helpful to me thank you :-)
will this still work if i filter out some reason codes please?
Thank you
Loren