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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Twizxup
Frequent Visitor

Calculating Joiners & Leavers in Cumulative/Appended Report

Hi All,

 

I receive a report every week that consists of our current workforce and, each week, I append it to the previous week's report. My ultimate goal is to allow the user select a specific Report Date and, based on that selection, display how many people have joined and left between the previous week's report and the selected report. What's important to note is that I need to be able to differentiate between people that transferred internally and people that joined/left externally (i.e. appeared or disappeared in the report).

 

Below is a sample dataset that includes the critical fields I'm working with. Some context on existing fields:

Concat 1 = if Count Resource = 1 and Flag = Y then concatenate Department + Resource ID

Concat 2 = concatenate Resource ID + Resource Name + Count Resource

 

The calculations I need help with are below:

Leaver = if Concat1 = null then 0 otherwise look up Concat1 in the next report date and if it exists then 0 otherwise 1

Leaver Elimination = if Leaver = 0 then 0 otherwise look up Concat2 in the next report date and if it exists then 0 otherwise 1

Joiner = if Concat1 = null then 0 otherwise look up Concat1 in the previous report date and if it exists then 0 otherwise 1

Joiner Elimination = if Joiner = 0 then 0 otherwise look up Concat2 in the previous report date and if it exists then 0 otherwise 1

 

Report DateReport Date IndexDepartmentResource NameResource IDFlagCount ResourceConcat1Concat2LeaverLeaver EliminationJoinerJoiner Elimination
1/1/20251FinanceAlex101N1 101Alex10000
1/1/20251SalesJared102Y1Sales102102Jared10000
1/1/20251SalesRebecca103N0 103Rebecca00000
1/1/20251FinanceStacy104Y1Finance104104Stacy11000
1/1/20251HRGerard105Y0 105Gerard00000
1/1/20251HRAdam106Y1HR106106Adam10000
1/1/20251SalesKristin107N1 107Kristin10000
1/8/20252FinanceAlex101N1 101Alex10000
1/8/20252SalesJared102Y1Sales102102Jared11100
1/8/20252SalesRebecca103N0 103Rebecca00000
1/8/20252SalesStacy104Y1Sales104104Stacy10010
1/8/20252HRGerard105Y0 105Gerard00000
1/8/20252HRAdam106Y1HR106106Adam10000
1/8/20252SalesKristin107N1 107Kristin10000
1/15/20253FinanceAlex101N1 101Alex10000
1/15/20253SalesRebecca103N0 103Rebecca00000
1/15/20253SalesStacy104Y1Sales104104Stacy10000
1/15/20253HRGerard105Y0 105Gerard00000
1/15/20253HRAdam106Y1HR106106Adam10000
1/15/20253SalesKristin107N1 107Kristin10000
1/15/20253HRMadison108Y1HR108108Madison10011

 

Calculation examples:

Leaver = Stacy transferred from Finance to Sales between 1/1/2025 and 1/8/2025, so she's counted as a Leaver (internal) on 1/1/2025

Leaver and Leaver Elimination = Jared appeared in the 1/8/2025 report but not in the 1/15/2025 report, so he's counted as a Leaver Elimination (terminated) on 1/8/2025

Joiner = Stacy transferred to Sales from Finance between 1/1/2025 and 1/8/2025, so she's counted as a Joiner (internal) on 1/8/2025

Joiner and Joiner Elimination = Madison appeared in the 1/15/2025 report but not in the 1/8/2025 report, so she's counted as a Joiner Elimination (new hire) on 1/15/2025

 

I suspect once the logic for one of these fields is figured out, the rest can be easily replicated. Any help would be hugely appreciated! Thank you in advance!

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Twizxup 

 

you can try this

 

Column =
var _next=maxx(FILTER('Table','Table'[Report Date Index]=EARLIER('Table'[Report Date Index])+1&&'Table'[Concat1]=EARLIER('Table'[Concat1])),'Table'[Concat1])
return if('Table'[Concat1]="",0,if('Table'[Report Date Index]=max('Table'[Report Date Index]),0,if(_next<>"",0,1))
)
 
Column 2 =
var _next=maxx(FILTER('Table','Table'[Report Date Index]=EARLIER('Table'[Report Date Index])+1&&'Table'[Concat2]=EARLIER('Table'[Concat2])),'Table'[Concat2])
return if('Table'[Column]=0,0,if('Table'[Report Date Index]=max('Table'[Report Date Index]),0,if(_next<>"",0,1))
)
 
Column 3 =
var _last=maxx(FILTER('Table','Table'[Report Date Index]=EARLIER('Table'[Report Date Index])-1&&'Table'[Concat1]=EARLIER('Table'[Concat1])),'Table'[Concat1])
return if('Table'[Concat1]="",0,if('Table'[Report Date Index]=min('Table'[Report Date Index]),0,if(_last<>"",0,1))
)
 
Column 4 =
var _last=maxx(FILTER('Table','Table'[Report Date Index]=EARLIER('Table'[Report Date Index])-1&&'Table'[Concat2]=EARLIER('Table'[Concat2])),'Table'[Concat2])
return if('Table'[Column 3]=0,0,if('Table'[Report Date Index]=min('Table'[Report Date Index]),0,if(_last<>"",0,1))
)
 
pls see the attachment below

 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
ryan_mayu
Super User
Super User

@Twizxup 

 

you can try this

 

Column =
var _next=maxx(FILTER('Table','Table'[Report Date Index]=EARLIER('Table'[Report Date Index])+1&&'Table'[Concat1]=EARLIER('Table'[Concat1])),'Table'[Concat1])
return if('Table'[Concat1]="",0,if('Table'[Report Date Index]=max('Table'[Report Date Index]),0,if(_next<>"",0,1))
)
 
Column 2 =
var _next=maxx(FILTER('Table','Table'[Report Date Index]=EARLIER('Table'[Report Date Index])+1&&'Table'[Concat2]=EARLIER('Table'[Concat2])),'Table'[Concat2])
return if('Table'[Column]=0,0,if('Table'[Report Date Index]=max('Table'[Report Date Index]),0,if(_next<>"",0,1))
)
 
Column 3 =
var _last=maxx(FILTER('Table','Table'[Report Date Index]=EARLIER('Table'[Report Date Index])-1&&'Table'[Concat1]=EARLIER('Table'[Concat1])),'Table'[Concat1])
return if('Table'[Concat1]="",0,if('Table'[Report Date Index]=min('Table'[Report Date Index]),0,if(_last<>"",0,1))
)
 
Column 4 =
var _last=maxx(FILTER('Table','Table'[Report Date Index]=EARLIER('Table'[Report Date Index])-1&&'Table'[Concat2]=EARLIER('Table'[Concat2])),'Table'[Concat2])
return if('Table'[Column 3]=0,0,if('Table'[Report Date Index]=min('Table'[Report Date Index]),0,if(_last<>"",0,1))
)
 
pls see the attachment below

 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you!! This works exactly as expected, I'll mark it as solved. Thanks for the quick response, huge help!

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




This is working exactly as I had hoped except for one thing that I'm hoping you can help with..

 

Instead of having the user select the Report Date, I have them select the Index (which I display as "Week #"). When the user selects an Index, I actually want to give the Leaver and Leaver Elimination values for the selected Index minus 1. So, for example: if the user selects Index 2, I want to return the Joiner and Joiner Elimination values for 1/8/2025 (Index 2), and the Leaver and Leaver Elimination values for 1/1/2025 (Index 1).

 

I assume this can be done with a slight adjustment to the formula, however I'm having trouble. Any help would be awesome!

 

Thanks again!

@Twizxup 

pls see if this is what you want





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi Ryan,

 

Thanks for the reply. Unless I'm missing something, I don't see a difference in the dashboard you attached. Using your file, I put together a matrix (see below, I'm not able to attach a screenshot for some reason).

 

Slicer filter: Index = 2

Resource NameColumn 3 (Joiner)Column (Leaver)
Adam00
Alex00
Gerard00
Jared01
Kristin00
Rebecca00
Stacy10
Total11

 

This is still showing Jared as a leaver in period 2 (which aligns with the table I provided in the original post), however I now want all of the leavers for the selected Index minus 1 (so in the case of Index 2 being selected, I want the leavers for Index 1 which would be Stacy).

 

I hope this makes sense.. Please let me know if there's anything I can clarify, and thank you again for your help on this!

@Twizxup 

pls see if this is what you want

11.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors