March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have an employee table with hire date and end date columns and a date table.
There is an active relation between Date[date] and Employee[end date] and an inactive relation between Date[date] and Employee[hire date].
The requirement is to show no of active employees in each month of the year in a column chart.
I have used the below DAX formula
Then, I have tried this Dax formula
This is a bette outcome.
But, the issue is this formula is not considering the hire date while calculating active resources.
for example, if an employee has a start date as 10/04/24 and end date as 31/07/24, he should only be included in the active employees in April, May, June and July. he shouldn't be included for the months before april 2024.
But this 2nd formula is including the above employee in every month till Jul 24.
Can someone help me to modify the DAX to calculate active employees considering both hire date and end date.
Thanks
Kartheek
Solved! Go to Solution.
Hi @KartheekJ ,
Regarding this topic, the key to solving your headcount issue is to set your calendar (date) table as a disconnected table from your employee table, which contains information such as employee ID, joining date, and leaving date. Then, you can write a DAX formula like the one below, enabling you to calculate headcount at any point in time!
Headcount =
SUMX (
EmployeeFact,
IF (
EmployeeFact[Start] <= [SelectedDate]
&& EmployeeFact[End] >= [SelectedDate],
1,
BLANK ()
)
)
Please refer to the article below if you’d like to explore this topic further.
Best regards,
Hi @KartheekJ ,
Regarding this topic, the key to solving your headcount issue is to set your calendar (date) table as a disconnected table from your employee table, which contains information such as employee ID, joining date, and leaving date. Then, you can write a DAX formula like the one below, enabling you to calculate headcount at any point in time!
Headcount =
SUMX (
EmployeeFact,
IF (
EmployeeFact[Start] <= [SelectedDate]
&& EmployeeFact[End] >= [SelectedDate],
1,
BLANK ()
)
)
Please refer to the article below if you’d like to explore this topic further.
Best regards,
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
21 | |
16 | |
14 |