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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
JKen1234
Frequent Visitor

Starters and Leavers

I need to write a Dax measure to identify starters and leavers but have some complications in the data and cant work out how to write it.

Each person could have multiple "appointments"(Role) such as a bank and a full time postion and may end a role but not leave or transition from one appointment to another. I also need the measure to be able to filter out bank roles and still work if we just want to look at non bank employees. Due to the nature of the work we get quite a few people rejoin and get put in under the same person number

 

If the data was entered correctly people would have a starting date only when they first start and a leaving date when they have left at a person level. The start and end date would indicate when each role has ended. but this doesnt seem to be the case.

 

I think I need to write a dax measure along the lines of a distinct count of person number if they have an appointment leaving date in the period without another appointment that is active in the period. but I cannot work out if this is possibel or how to go about it.

 

Data example below

 

Person NumberAppointment NumberStart DateStarting DateEnd DateLeaving DateAppointment Type
123100301/02/2001(blank)01/09/200601/09/2006Permament
123118702/01/200702/01/200702/09/200802/09/2008Temporary
123125003/09/2008(blank)31/10/202231/10/2022Bank
123125602/01/200702/01/200731/10/202231/10/2022Bank
123152701/10/201501/10/201530/06/2016(blank)Temporary
456161323/03/202023/03/202031/10/202231/10/2022Bank
789161816/12/202016/12/202007/10/202207/10/2022Permament
101163008/01/202108/01/202120/10/202220/10/2022Bank
101165103/08/202203/08/202204/10/2022(blank)Temporary
121163925/01/202225/01/202219/10/202219/10/2022Permament
14516302/12/202102/12/202104/10/202204/10/2022Bank
145164604/07/202204/07/202204/10/202204/10/2022Temporary
167164319/04/202219/04/202226/10/202226/10/2022Permament
189164921/06/202221/06/202203/10/202203/10/2022Permament
189165304/10/202204/10/2022(blank)(blank)Bank
201164407/05/202207/05/202227/10/202227/10/2022Bank
223165213/09/202213/09/202213/10/202213/10/2022Permament
245165903/10/202203/10/202210/10/202210/10/2022Permament

 

Any help would be greatly appreciated!

2 REPLIES 2
amitchandak
Super User
Super User

@JKen1234 , refer if approach in this blog can help

 

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

 

or in the attached files

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi, Thanks unfortunately those solutions dont quite fit my data issues. Ive tried wrting something along the lines of the below but I cant work out how to get the not fucntion to impact the first part.

 

=CALCULATE(DISTINCTCOUNT(Appointments[Person Number]),FILTER(Appointments,
Appointments[Leaving Date]>=MIN('Calendar'[Date])&&Appointments[Leaving Date]<=MAX('Calendar'[Date])&&NOT(Appointments[Start Date]<=MAX('Calendar'[Date])&&([End Date]>MAX('Calendar'[Date])||ISBLANK([End Date])))
)
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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