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.
Hi,
I have the following data on headcount.
Name | Position | Start Date | End Date | Current Status |
Joe Bloggsd | Head of Marketing | 21/02/2017 | Established | |
Noah Anyone | Head of Operations | 21/06/2017 | 20/07/2019 | Left |
Joe Bloggs Jnr | VP Marketing | 21/07/2018 | 20/01/2020 | Transfer Out |
I want to be able to calculate the number of employees we had at a particular date. This would ideally be one filter that I could select a date from and it would give me the total number of employees at that date, that includes those who are currently established, who had just started, who have since left etc. I.e. just a date filter that enables me to say - So at 31st March 2019 how many people did we have in the business, where were they and what were they doing?
Easy enough for those estabslihed but need to include those who have since left but were established employees at that time.
Many thanks.
Hi @tobiasmcbride ,
You can refer to this blog:https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please see the attached file with a solution that creates an extra table in Power Query that expands your dates.
it depends on you data model
it will be like
Measure =
CALCULATE(Countrows('Headcount'); FILTER(ALL('Headcount'); 'Headcount'[StartDate] <= SELECTEDVALUE([Date]) && (ISBLANK('Headcount'[EndDate]) || 'Headcount'[EndDate] >= SELECTEDVALUE([Date]))
the best practice is to create a calendar table like
CalendarTable = CALENDARAUTO()
and then dd a measure above
@V-lianl-msft has suggested the solution, which should fit in your required. In case you do not have a join between strat date and date table, then try the second formula
Current Employees = CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]<=max('Date'[Date])
&& (ISBLANK(Employee[End Date]) || Employee[End Date]>max('Date'[Date])))
,(Employee[Employee Id ])),CROSSFILTER(Employee[Start Date],'Date'[Date],None))
Current Employees = CALCULATE(COUNTx(FILTER(Employee,Employee[Start Date]<=max('Date'[Date])
&& (ISBLANK(Employee[End Date]) || Employee[End Date]>max('Date'[Date])))
,(Employee[Employee Id ])))
OK so when I try that it states that the function "selected value' has been used in a true/false expression that is used as a table filter expressxion. this is not allowed?
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 |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |