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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
AkameNoGamma
Frequent Visitor

Help with Dax formula - Department Transfers

I am looking for a formula that can calculate department transfers based on the effective date of an employee's move from one department to another. My goal is to compute the opening and closing headcount for each department every month. While I have the formula for new hires and separations, I need to include the count for department transfers to complete the data. I have searched for guides on headcount and attrition computations, but none of them take department transfers into account.

 

I have attached a table that I currently have on my dashboard, which is missing the columns for "Move In" and "Move Out".

 

File Link: https://docs.google.com/spreadsheets/d/17r-CCpVN0IEgnZlg9ShjycDVKhhvGDhJ/edit?usp=drive_link&ouid=11...

 

Expected Result

as of April 2023      
DepartmentOpening HeadcountNew HiresSeparationMove inMove OutClosing Headcount
Air Business Subscriptions151 5 1145
Amex US30152 142
Audit &Certification2 11 2
Beach2520 1 46
Bose30   228
CBE2223 1 46
Gurus19 21 18
McDonalds15 22213
New Wonder10010 2 112
Quest165 2320
Training21 11 21
Vizio3033 228

 

 

Sample Data (which is also transcribe in the table above)

Local IDEffective Start DateNew DepartmentPrevious Department
M1505394/3/2023BeachAir Business Subscriptions
M1244524/1/2023CBEAmex US
M975634/17/2023Audit &CertificationBose
M957454/25/2023TrainingBose
M1377934/24/2023QuestMcDonalds
M1489654/25/2023QuestMcDonalds
M1403554/17/2023GurusQuest
M1371834/24/2023New WonderQuest
M1392004/24/2023New WonderQuest
M1494754/10/2023McDonaldsVizio
M1494764/10/2023McDonaldsVizio
1 ACCEPTED SOLUTION
v-jialongy-msft
Community Support
Community Support

Thank you for your prompt reply! @lbendlin 

 

Hi @AkameNoGamma 

Please try the following Dax:

Move in:

Move in = 
VAR department =SELECTEDVALUE('Table'[Department])
RETURN CALCULATE(COUNTROWS('Table (2)'),FILTER('Table (2)','Table (2)'[New Department] = department))

 

move out:

Move out = 
VAR department =SELECTEDVALUE('Table'[Department])
RETURN CALCULATE(COUNTROWS('Table (2)'),FILTER('Table (2)','Table (2)'[Previous Department] = department))

 

Result:

Result = SELECTEDVALUE('Table'[Opening Headcount]) + SELECTEDVALUE('Table'[New Hires]) + [Move in] - [Move out] - SELECTEDVALUE('Table'[Separation])

 

vjialongymsft_0-1715827279468.png

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-jialongy-msft
Community Support
Community Support

Thank you for your prompt reply! @lbendlin 

 

Hi @AkameNoGamma 

Please try the following Dax:

Move in:

Move in = 
VAR department =SELECTEDVALUE('Table'[Department])
RETURN CALCULATE(COUNTROWS('Table (2)'),FILTER('Table (2)','Table (2)'[New Department] = department))

 

move out:

Move out = 
VAR department =SELECTEDVALUE('Table'[Department])
RETURN CALCULATE(COUNTROWS('Table (2)'),FILTER('Table (2)','Table (2)'[Previous Department] = department))

 

Result:

Result = SELECTEDVALUE('Table'[Opening Headcount]) + SELECTEDVALUE('Table'[New Hires]) + [Move in] - [Move out] - SELECTEDVALUE('Table'[Separation])

 

vjialongymsft_0-1715827279468.png

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much! This absolutely solved my problem, but now i'm in a rabbit hole because of a new problem. i'll post it on a different thread. thanks!!!

lbendlin
Super User
Super User

The google link asks for access. Please check.

weird, i thought i already updated the share link. check now if it works.

Your sample data is not matching the expected outcome. Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Thank you for looking this out. I believe i was able to provide the sample data and it is just a simple table with the basic formula to get the closing headcount which involves the following parameters:

 

Closing Headcount = (Opening Headcount + New Hires + Move In) - (Separations + Move Out).

 

In my table i only provided the list of move in and out since i already have the dax for the rest of the parameters above.

 

can you point out what is the issue with my "expected result"?

I cannot assist you if you are unable to provide meaningful sample data. I hope someone else can help you further.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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