Forum Discussion
Monthly headcount based on hire date formula
In general that's much more complex tax which is better to do with database or Excel tables whic imitates database. Tables could be
- departments: ID and name
-employees: ID, name, perhaps other static information like birthday
- employees history: date, employee ID, department ID (in case of change), within it hiring and termination dates
- calendar with each date for entire history
Above is simplified, could be bit more complex
After that Power Query itself or in combination with data model operations could generate desired reports.
Less reliable way is with formulas, but least you need to have termination date in your records.
- zrob94Feb 07, 2022Copper Contributor
SergeiBaklan Hi i have a smiliar question trying to get monthly headcount for a particular department i have start dates and leave dates
Similar data to the person below but also leave dates.
I dont know what countifs function to use to get the monthly data for example all employees at X department up until 31st January 2022.
- SergeiBaklanFeb 07, 2022Diamond Contributor
You need to define more carefully what the "monthly headcount" is.
For example, in department you had person who quit on 18 January 2022 and another person joined the company and this department on 14 January 2022.
Thus you have 1 person till 14th, 2 persons from 14th to 18th and 1 person from 18t till end of January. You may calculate number of persons on first of each month, or average, or on the end of each month, or use other combinations. Each has pros and cons. Perhaps on the end of the month is most common, such situation when you have 1 person during entire month, one more joined on 31st and we have headcount in this month = 2 are considered as acceptable.
Logic could be like
=SUMPRODUCT( (Staff[Start Date] <= [@Month] ) * ( ( Staff[Quite Date] >= [@Month] ) + ( Staff[Quite Date] = "" ) ) )