Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear community,
I am struggling of counting the number of active employees by selecting different year and month.
The result that I am expecting is by selecting the time slicer month and year, it shows the actual number of employee of the month and year selected.
In result, we could also show a curve of evolution of number of employees by time.
Please kindly find the data sample in attachment.
https://drive.google.com/file/d/12tJdT2qCtC7wsRC70_VAkXKf1vWXSn8Z/view?usp=sharing
I've tried the popular formula like below, However the result is always less than the real number.
Current Employees = CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]<=max('Date'[Date]) && (ISBLANK(Employee[End Date])
Solved! Go to Solution.
Hi @Vanivanivani ,
You need a calendar table. There's no relationship between tables.
Calendar = CALENDAR(MIN('Employee'[Start Date]),MAX('Employee'[End Date]))
Create the following measure.
Count = CALCULATE(COUNTROWS('Employee'),FILTER('Employee',[Start Date]<MIN('Calendar'[Date])&&([End Date]>MAX('Calendar'[Date])||[End Date]=BLANK())))
The result is this. You can check more details from the attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Vanivanivani ,
You need a calendar table. There's no relationship between tables.
Calendar = CALENDAR(MIN('Employee'[Start Date]),MAX('Employee'[End Date]))
Create the following measure.
Count = CALCULATE(COUNTROWS('Employee'),FILTER('Employee',[Start Date]<MIN('Calendar'[Date])&&([End Date]>MAX('Calendar'[Date])||[End Date]=BLANK())))
The result is this. You can check more details from the attachment.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You'll need to include the employees who have an end date which is greater than the selected date (in context), not just the blank end date.
So that's adding an OR condition to the 2nd clause.
I think there are syntax problems with the current formula too. Probably replace the calculate(countx with COUNTROWS
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |