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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
RopJD
New Member

Headcount in time period

Hi,
I would like to use a splicer to get a Headcount on any chosen day.
I have a MasterDate table with every date populated from 2008-2030.
I have a measure that is working to calculate "TODAY" Headcount.
TodayHeadcount2.png
I need help with a measure to calculate the headcount on any given day.
My data is updated daily which is why today's headcount is always accurate. There is always an "EffectiveDate" for "Today" with the most recent action regardless of how long ago it was. My sample data should show this.

EffectiveDateEmployeeIDNAMEEmployee StatusActionLastHireDateTermination Date
2023-07-0687Joe BrownITermination2010-01-012010-06-01
2023-07-06137John DoeAData Change2021-11-03 
2023-07-06256Mary JaneITermination2023-06-152023-07-01
2023-07-01256Mary JaneITermination2023-06-152023-07-01
2023-06-15256Mary JaneAHire2023-06-15 
2023-04-12137John DoeAData Change2021-11-03 
2023-03-30137John DoeAPay Increase2021-11-03 
2023-01-05137John DoeAData Change2021-11-03 
2022-03-31137John DoeAPay Increase2021-11-03 
2022-01-10137John DoeANew Assignment2021-11-03 
2021-11-03137John DoeARehire2021-11-03 
2021-10-28137John DoeITermination2021-04-262021-10-27
2021-04-26137John DoeARehire2021-04-26 
2021-04-24137John DoeITermination2020-10-152021-04-23
2021-04-01137John DoeAPay Increase2020-10-15 
2020-12-07137John DoeAData Change2020-10-15 
2020-12-03137John DoeAData Change2020-10-15 
2020-11-17137John DoeAData Change2020-10-15 
2020-11-05137John DoeANew Assignment2020-10-15 
2020-10-15137John DoeARehire2020-10-15 
2020-09-22137John DoeITermination2020-08-042020-09-21
2020-08-26137John DoeAData Change2020-08-04 
2020-08-04137John DoeARehire2020-08-04 
2020-05-18137John DoeITermination2019-10-172020-05-17
2020-04-30137John DoeILayoff2019-10-172020-04-29
2020-04-30137John DoeASeverance2019-10-172020-04-29
2020-04-30137John DoeAData Change2019-10-172020-04-29
2020-03-31137John DoeAData Change2019-10-17 
2020-03-19137John DoeAPay Increase2019-10-17 
2019-10-17137John DoeARehire2019-10-17 
2019-08-31137John DoeITermination2019-05-062019-08-30
2019-05-06137John DoeARehire2019-05-06 
2018-09-01137John DoeITermination2018-05-072018-08-31
2018-05-07137John DoeARehire2018-05-07 
2017-09-01137John DoeITermination2017-05-012017-08-31
2017-05-01137John DoeAHire2017-05-01 
2010-06-0187Joe BrownITermination2010-01-012010-06-01
2010-06-0187Joe BrownARetirement2010-01-012010-06-01
2010-01-0187Joe BrownAHire2010-01-01 


My problem with my above code is that John Doe counts as 0 headcount beyond his LastHireDate.
My expected result is to have a headcount on any given day using a splicer from MasterDates.
Today = 1.
2023-06-20 = 2
2021-09-01 = 1
2016-01-01 = 0
Any help is appreciated.

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi, @RopJD 

Thanks for your sample data ! According to your dax , the relationship between two tables seems to this:
'ALL EmpioyDate'[LastHireDate] ---- 'Mater Date'[Date]?

 

And for your need , sorry for i am not clear about how to get the result from your sample data:

Today = 1.
2023-06-20 = 2
2021-09-01 = 1
2016-01-01 = 0

 

In your dax , you compare the [LastHireDate] and the [Termination Date] with the Master Date[Date]. But you use the [EffectiveDate]=TODAY() to filter and i do not understand what you want to get for the last.

Can you give me the detailed calculation steps for your result like 2021-09-01 = 1,2023-06-20 = 2 and Today = 1 based on your sample data? Can you provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

 

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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