Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext 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
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.
| id | start_date | end_date |
| 1 | 07.02.2015 | 26.02.2015 |
| 1 | 27.02.2015 | 08.08.2015 |
| 1 | 09.12.2015 | |
| 2 | 26.01.2019 | 03.03.2019 |
| 3 | 14.02.2012 | 27.08.2012 |
| 3 | 17.08.2017 | 12.01.2019 |
| 3 | 31.12.2020 |
Thanks
Hi @Anonymous ,
Here are the steps you can follow:
1. Create a calendar table.
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.
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.
Hi, @Anonymous
Please check the below picture and the sample pbix file's link down below.
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
Hi, @Anonymous
Sorry, I am not sure whether your response is a question.
@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.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 32 | |
| 27 | |
| 25 |