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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors