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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Hiring, termination, Active Headcount based on historical data

Hi,

I am looking for a DAX measure to calculate above measures based on historical staff data at any period in time. Below is the sample of how data looks like.

 

idstart_dateend_date
107.02.201526.02.2015
127.02.201508.08.2015
109.12.2015 
226.01.201903.03.2019
314.02.201227.08.2012
317.08.201712.01.2019
331.12.2020 

 

Thanks

5 REPLIES 5
Anonymous
Not applicable

Hi  @Anonymous ,

Here are the steps you can follow:

1. Create a calendar table.

v-yangliu-msft_0-1623201425542.png

2. Create measure.

Measure =
var _select=SELECTEDVALUE('Date'[Date])
var _table=SELECTCOLUMNS('Table (2)',"start",[start_date],"end",IF([end_date]=BLANK(),TODAY(),[end_date]))
return
COUNTX(FILTER(_table,[start]<=_select&&[end]>=_select),[start])

3. Result.

v-yangliu-msft_1-1623201425550.jpeg

What do you mean by "assisted with the logic behind calculating hire & termination count" is not very clear, is it a new field, can you describe it?

 

Best Regards,

Liu Yang

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

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below.

 

Picture2.png

 

Active Headcount =
CALCULATE (
DISTINCTCOUNT ( Data[id] ),
FILTER (
Data,
OR ( Data[end_date] >= MIN ( Dates[Date] ), Data[end_date] = BLANK () )
&& Data[start_date] <= MAX ( Dates[Date] )
)
)

 

 

https://www.dropbox.com/s/l9uhw7owv0z5xjg/kunalv2.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Anonymous
Not applicable

@Jihwan_KimThanks,  I tried modifying the formula to this giving active employee at any point in time based on date filter:
Active Headcount =
CALCULATE (
DISTINCTCOUNT ( Data[id] ),
FILTER (
Data,
OR ( Data[end_date] >= MIN ( Dates[Date] ), Data[end_date] = BLANK () )
&& Data[start_date] <= MAX ( Dates[Date] )
), REMOVEFILTERS(Dates)
)

Hi, @Anonymous 

Sorry, I am not sure whether your response is a question.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Anonymous
Not applicable

@Jihwan_Kim Also, if you could assist with the logic behind calculating hire & termination count . The situation looks like for event in progress scenario. Many thanks.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.