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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Dimitris_Kats
Helper V
Helper V

Headcount per month

Hello members,

 

I need your help to calculate future headcount based on monthly planning for next year.

 

I have a table per position and employee ID with the headcount at the end of 2021 and the new hires per month for 2022

DividionPositionEmployee_ID  Headcount 2021 monthNew Hires
IT Web Adminitrator 123456  1 1/1/2022 1
IT Web Adminitrator 123456  1 1/2/2022 0
IT Web Adminitrator 123456  1 1/3/2022 3
IT Web Adminitrator 123456  1 1/4/2022 2
IT Web Adminitrator 123456  1 1/5/2022 0
IT Web Adminitrator 123456  1 1/6/2022 0
IT Web Adminitrator 123456  1 1/7/2022 0
IT Web Adminitrator 123456  1 1/8/2022 0
IT Web Adminitrator 123456  1 1/9/2022 0
IT Web Adminitrator 123456  1 1/10/2022 0
IT Web Adminitrator 123456  1 1/11/2022 0
IT Web  Adminitrator 123456  1 1/12/2022 0
FINANCE Accountant 123457  3 1/1/2022 -1
FINANCE Accountant 123457  3 1/2/2022 0
FINANCE Accountant 123457  3 1/3/2022 0
FINANCE Accountant 123457  3 1/4/2022 0
FINANCE Accountant 123457  3 1/5/2022 2
FINANCE Accountant 123457  3 1/6/2022 0
FINANCE Accountant 123457  3 1/7/2022 0
FINANCE Accountant 123457  3 1/8/2022 0
FINANCE Accountant 123457  3 1/9/2022 0
FINANCE Accountant 123457  3 1/10/2022 0
FINANCE Accountant 123457  3 1/11/2022 0
FINANCE Accountant 123457  3 1/12/2022 0

 

I need to add to the 2021 headcount the every month new hirings.

The result i am seeking is:

 

 1/1/20221/2/20221/3/20221/4/20221/5/20221/6/20221/7/20221/8/20221/9/20221/10/20221/11/20221/12/2022
Web Adminitrator 225777777777
Accountant 222244444444


 Do you think thats possible?

 

Thank you very much in advance!

1 ACCEPTED SOLUTION
Dimitris_Kats
Helper V
Helper V

I found the dax i was looking for. I am writting it here in case someone needs it 🙂

CALCULATE(SUMX('table', 'table'[new hires]),ALLEXCEPT('table','table'[Employee_ID]), 'table'[Month] <= EARLIER('table'[Month]))

View solution in original post

4 REPLIES 4
Dimitris_Kats
Helper V
Helper V

I found the dax i was looking for. I am writting it here in case someone needs it 🙂

CALCULATE(SUMX('table', 'table'[new hires]),ALLEXCEPT('table','table'[Employee_ID]), 'table'[Month] <= EARLIER('table'[Month]))
Dimitris_Kats
Helper V
Helper V

So i have manage to achive what I want only for 1 month. I need cumulative to achive it for all months.

This is the calculated column i created: 

Cumulative Headcount 2022 = if('table'[Month] = date(2022,01,01), 'table'[2021 Total]+ 'table'[New Hires]'table'[2021 Total]+ 'table'[New Hires] + CALCULATE(SUM( 'table'[New Hires]), allexcept('table','Headcount - Total & Monthly'[Employee_ID]),  PREVIOUSMONTH('table'[Month])))
 
This measure works ok only for the second month for the year. I need at the third month to add the previous 2 months etc and i have no idea how to achive it. 😞
amitchandak
Super User
Super User

@Dimitris_Kats , Hope you are using a date table for this one. So for head count 2021 , you remove join with date table using cross filter or create a measure like

 

calculate([Head count], filter(All('Date') , 'date'[Year] =2021))

 

You can add this to your 2022 measure

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello and thank you very much for your reply.

 

I am not using a date table. I have the headcount of 31/12/21 in this table and I have also dates in this table for 2022 new hires.
I don't need the 2021 headcount, I already have it. I need to cumulative calculate the headcount per month for 2022 adding the new hirings.

Thank you in advance

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.