Power BI How-To / HR Measures

How to Build Power BI Headcount Over Time from Hire and Termination Dates

Power BI headcount over time means counting the employees who were active on each date of your axis, using nothing more than a hire date and a termination date per person. This guide covers the measure logic only, and it works the same whatever HR system the data came from: period-end, any-day and average headcount, the turnover denominator, and the totals, termination-date and rehire mistakes that make trends wrong. Getting the data out of a specific system is a separate job, covered on our Workday Power BI dashboard page and its sibling connector pages.

The short version

Four decisions behind every headcount trend line

Which headcount you mean

Period-end, anyone employed during the period, or an average across it. Each is correct for a different question, and mixing them on one page is how two reports disagree.

A Date table that does not filter employees

The measure compares dates itself. An active relationship from the calendar to hire date quietly turns headcount into a count of new hires.

What the termination date means

Last day worked or first day gone? The answer decides whether one comparison is >= or >, and getting it wrong shifts every leaver by one period.

Measure or monthly snapshot

A date-range measure is small and always current; a month-end snapshot table freezes department and location as they were. Pick by the history you need to report.

What does a headcount trend actually count?

A headcount trend counts, for each period on the axis, the employees whose employment overlapped that period. The overlap rule decides the number: active on the last day of the period, active on any day of it, or active on average across it. All three come from the same hire and termination dates; they answer different questions.

Three headcount definitions, the date condition behind each, and when to use it.
Definition Employee is counted when Best for Watch out for
Period-end headcount Hired on or before the period end, and not yet terminated at the period end Month-end trend lines, org size by department, board packs A hiring wave or layoff near the cutoff moves it sharply
Employed during the period Hired on or before the period end, and terminated on or after the period start (or not terminated) Anyone who needed a payslip, a laptop or a review in that period Always at least as high as period-end; a full year can far exceed any single month
Average headcount The mean of the period-end counts inside the selected range Turnover-rate denominators, cost per employee The averaging grain (daily, monthly, opening plus closing) must be stated

Most HR questions want period-end headcount on the trend line and average headcount underneath any rate. ‘Employed during’ is useful for capacity and cost questions, but it is the number that most often gets mislabelled as headcount, because it is the easiest to build with a single filter.

What data and model do you need?

You need one employee table with an employee ID, a hire date and a termination date that stays blank for current staff, plus a continuous Date table. Department, location and job attributes can sit on the same table. The Date table must not filter the employee table through an active relationship on hire date.

That last rule surprises people who follow the usual star schema guidance from Microsoft (opens in new tab), where the calendar filters the fact. Here the employee table is not a fact keyed to one date: each row spans a range. If the calendar filters Employees[HireDate], selecting March leaves only people hired in March, and the measure counts new hires. Leave the Date table disconnected from employees for the headcount measures. If you also want a terminations count by month, add an inactive relationship from 'Date'[Date] to Employees[TermDate] and switch it on inside that one measure. Our guide to time intelligence DAX and Date tables covers building and marking the calendar itself.

If people can leave and come back, store one row per employment spell (employee ID plus hire date) rather than one row per person, and count distinct employee IDs. A single row holding only the latest hire date erases the first spell from history.

Which DAX measure counts active employees at each period end?

Take the last date visible in the current filter as the period end, then count employees hired on or before it whose termination date is blank or falls on or after it. Wrapped in CALCULATE, that one measure gives month-end, quarter-end and year-end headcount from the same formula, because the period end moves with the axis.

The core headcount measures. Each assumes the Date table is not actively related to the Employees table.
Measure DAX What it returns
Headcount VAR PeriodEnd = MIN( MAX( 'Date'[Date] ), TODAY() ) RETURN CALCULATE( DISTINCTCOUNT( Employees[EmployeeID] ), Employees[HireDate] <= PeriodEnd, Employees[TermDate] >= PeriodEnd || ISBLANK( Employees[TermDate] ) ) Employees active on the last day of the period (or today, for the current period)
Employed During Period VAR PeriodStart = MIN( 'Date'[Date] ) VAR PeriodEnd = MAX( 'Date'[Date] ) RETURN CALCULATE( DISTINCTCOUNT( Employees[EmployeeID] ), Employees[HireDate] <= PeriodEnd, Employees[TermDate] >= PeriodStart || ISBLANK( Employees[TermDate] ) ) Anyone employed on at least one day of the period
Average Headcount AVERAGEX( VALUES( 'Date'[Year Month] ), [Headcount] ) The mean of the month-end headcounts inside the selection
Terminations CALCULATE( DISTINCTCOUNT( Employees[EmployeeID] ), USERELATIONSHIP( 'Date'[Date], Employees[TermDate] ) ) Leavers whose termination date falls in the period

Both filter arguments in Headcount are Boolean filters on a single column, which CALCULATE accepts and applies together. The ISBLANK test matters: current employees have no termination date, and without it they drop out of every period. TODAY() caps the period end so the current month shows today’s staff rather than people whose termination is already booked for later in the month. Microsoft’s CALCULATE function reference (opens in new tab) documents the Boolean filter rules these measures rely on.

How do you count anyone employed during a period?

Change one comparison. An employee overlaps a period when they were hired on or before its last day and their termination is blank or on or after its first day. That overlap test, which Excelerator BI walks through in its how-many-employees-by-period article, is the Employed During Period measure in the table above.

The two boundaries are what make it work: the hire test uses the period end and the termination test uses the period start. Swap them and you count only people who were present for the whole period. Excelerator BI’s write-up of the overlap logic (opens in new tab) builds the same condition with explicit first-date and last-date variables. Use this number for questions like ‘how many people did we pay in Q3’, not for the headline trend.

Which headcount should a turnover rate use?

Use average headcount as the denominator. A period-end count reflects a single day and swings with any hiring wave or layoff near the cutoff, while ‘employed during’ inflates the base with the leavers themselves. Divide Terminations by Average Headcount, and state the averaging method on the report so the rate can be reproduced.

The measure is Turnover Rate = DIVIDE( [Terminations], [Average Headcount] ). Over a single month the average is just that month’s end count; over a year it is the mean of twelve month-end counts. Some HR teams define average headcount as opening plus closing headcount divided by two; that is a policy decision, not a DAX one, and the formula changes to DIVIDE( [Opening Headcount] + [Headcount], 2 ) with Opening Headcount evaluated at the day before the period starts. This page gives no turnover benchmarks: compare your own periods with each other, on one definition, rather than against a published figure built on a different one.

What does a worked headcount example look like?

Below is an illustrative five-person team over one quarter, on sample data. It shows how the three definitions diverge, how a termination on the last day of a month changes the count depending on the comparison operator, and why the quarter total must not be a sum of the months.

The sample team: A and E were employed before the quarter and E’s recorded termination date is the last day of Month 3; B was employed before the quarter and terminated on day 14 of Month 2; C was hired on day 10 of Month 1; D was hired on day 3 of Month 3. A, C and D are still employed.

Illustrative sample data, not client results: headcount for a five-person team across one quarter under each definition.
Period Period-end, TermDate >= end Period-end, TermDate > end Employed during period
Month 1 4 (A, B, C, E) 4 4 (A, B, C, E)
Month 2 3 (A, C, E) 3 4 (B still counts)
Month 3 4 (A, C, D, E) 3 (E excluded) 4 (A, C, D, E)
Quarter, correct measure 4 3 5
Quarter, months summed (wrong) 11 10 12
Average headcount 3.67 3.33 Not used

Read the Month 3 row first. If your HR system records the termination date as the last day worked, E was still employed at the close of Month 3, so >= is right and the count is 4. If it records the first day the person is gone, > is right and the count is 3. Neither operator is universally correct; check what your export means before trusting either column. Then note that the correct quarter figure equals the Month 3 value for period-end headcount, but 5 for ‘employed during’, because everyone who worked any day of the quarter counts once.

Why are my headcount numbers wrong?

Most broken headcount reports trace to six causes: totals that sum months, an active Date relationship on hire date, a termination-date convention applied the wrong way, blank or placeholder termination dates, rehires stored as one row, and current-only department attributes restating history. Check those before rewriting the measure.

  1. Totals that add months together. Headcount is semi-additive: it adds across departments, never across time. A snapshot table summed over a year returns roughly twelve times the real figure. Return the latest snapshot in the filter instead (see the snapshot measure below).
  2. An active relationship on hire date. The trend shows small numbers that look like monthly hires. Make the relationship inactive or remove it.
  3. Off-by-one termination dates. Leavers appear one month too long or too short. Confirm whether the date is the last day worked, then pick >= or > to match.
  4. Blank or placeholder termination dates. Some exports fill current staff with a far-future date, others leave the field empty, and a few send text. Convert placeholders to blank and set the column type to Date in Power Query so ISBLANK behaves.
  5. Rehires. One row per person keeps only the latest spell, so a returner vanishes from the months before they first left. Load one row per spell and count distinct employee IDs.
  6. Department history that moves. If the employee table holds only the current department, last year’s headcount by department is restated every time someone transfers. Fix it with an effective-dated job history or a month-end snapshot.

A seventh failure is performance. Expanding every employee into one row per day of employment in Power Query looks like the simple fix, but the table grows with every employee and every day of tenure, and it is behind the out-of-memory refresh errors people report on community forums. The measures above need no expansion at all.

Should you use a date-range measure or a monthly snapshot table?

Start with the date-range measure: one table, no expansion, and it answers any period on any axis. Move to a month-end snapshot table when you must report headcount by the department, manager or location people had at the time, because a measure over current attributes restates history whenever someone transfers.

Trade-offs between the two headcount model designs.
Consideration Date-range measure Month-end snapshot table
Model size One row per employment spell One row per employee per month-end; grows every month
Historical department or location Current values only, unless joined to effective-dated job history Frozen as they were at each month-end
Granularity Any date, week, month or fiscal period Month-end only, unless you snapshot more often
Correcting a backdated termination Fixed automatically on the next refresh Past snapshots keep the old answer unless rebuilt
Totals Correct by construction (evaluated at the period end) Need a last-snapshot measure; a plain count sums months

For the snapshot design, the semi-additive measure is CALCULATE( COUNTROWS( Snapshot ), LASTNONBLANK( 'Date'[Date], CALCULATE( COUNTROWS( Snapshot ) ) ) ), with the Date table related to the snapshot’s month-end date. LASTNONBLANK picks the latest month-end that has rows, so a year total returns the last loaded month even when the calendar runs to December. The same ‘evaluate at a point, not over a range’ idea sits behind cumulative measures; our running total DAX guide covers the contrasting pattern that does accumulate across dates.

Where does the employee data come from?

Any HR or payroll system that can export employee ID, hire date and termination date will feed these measures. The extraction route is what differs: report-as-a-service feeds, REST APIs or scheduled custom reports, each with its own authentication and refresh limits. Those system-specific details live on separate connector pages rather than here.

For Workday, effective-dated worker records and the supervisory organization hierarchy are covered on the Workday Power BI dashboard page. ADP Workforce Now extraction is on the ADP Power BI dashboard page, the Paylocity API route is on the Paylocity Power BI dashboard page, and UKG Pro report extracts are on the UKG Pro Power BI dashboard page. Whichever source you use, check two things in the first export: whether termination dates mean last day worked, and whether rehires arrive as new rows or overwrite the old one.

When should a senior engineer build it for you?

Bring in help when headcount feeds a board pack or a turnover target and the source data is untidy: rehires, transfers that must be reported historically, several HR systems after an acquisition, or a refresh that already runs out of memory. The measures here are short; agreeing definitions and cleaning spells is where the hours go.

Power BI Flex Support is prepaid, senior-led Power BI hours that never expire, with no contracts and no project minimums. Blocks are Starter $2,500, Growth $4,600 and Power $8,000, and hourly work starts from $100. You send the request, we reply with a scope and an hours estimate before any work, hours are deducted only for work you approve, and most tasks land 3–5 business days after approval. If headcount is one symptom of a tangled model, the same hours cover data modeling and DAX work. Contact is through the form on this site.

FAQ

Frequently asked questions

The usual convention is to divide terminations by average headcount, because a period-end count reflects a single day and swings with any hiring wave or layoff near the cutoff. Average the month-end counts across the period, or average opening and closing headcount if that is your documented policy. Label the choice on the report.

Headcount is semi-additive: it adds across departments but not across time. If a monthly snapshot table is summed, a full year returns roughly twelve times the real figure. Return the last available snapshot instead, or use a measure that evaluates at the latest date in the current filter, so the year total equals the year-end count.

Not with an active relationship on hire date. An active link filters employees to people hired inside the selected month, so the measure counts new hires instead of everyone employed. Leave the Date table disconnected from the employee table, or keep the relationships inactive, and let the measure compare hire and termination dates to the period boundaries itself.

Store one row per employment spell, keyed by employee ID and hire date, rather than one row per person. A spell table keeps the gap between leaving and returning. Then count with DISTINCTCOUNT on the employee ID instead of COUNTROWS, so someone who left and came back inside the same month is counted once.

Yes. A senior, US-based, Microsoft-certified engineer can build the headcount measures, date table and report on your own HR export from prepaid Flex hours that never expire. Blocks are Starter $2,500, Growth $4,600 and Power $8,000, with hourly work from $100. We quote the hours before starting, and most tasks land in 3 to 5 business days after approval.

Try us risk-free for 4 hours

If you’re unhappy within the first 4 hours of your block, we’ll refund you in full — no questions asked. Hours are deducted only for work you’ve reviewed and approved, and they never expire.

Want a headcount trend HR and finance both accept?

Bring your HR export to a free demo. We confirm what your termination dates mean, agree the headcount definition with you, and build the measures on prepaid hours that never expire. Most tasks land in 3–5 business days.

Scope approved before any hours are used · Hours never expire

Book a free demo

See what your Power BI reporting would take

Tell us the task. We reply within one business day, and you get a scope estimate and the hours needed before any work begins.

Step 1 of 2: What do you need?

How can we help? Pick one

Tap to add, or type your own:

Step 2 of 2: Where should we reply?

Used only to contact you about this inquiry.

We reply within one business day. Scope approved before any hours are used. We don’t sell your information.

Tell us the task. We scope it, you approve, and a senior consultant delivers — typically in 3–5 business days. Prepaid hours that never expire.

  • Prepaid hours from $100/hour — and they never expire
  • Senior-led delivery — 20+ years on the Microsoft platform
  • Typical 3–5 business day turnaround
  • Full refund if you’re unhappy in your first 4 hours
Book my free demo