Case 1: headcount at a cutoff date

How many people work in each department, and how has the headcount changed over the year? You connect the departments, count the active employees and calculate the headcount at the end of every month.

In short: active employees have no leave date, so COUNTROWS(FILTER(Employee, ISBLANK(Employee[LeaveDate]))) counts them. The headcount at a cutoff date comes from a measure with VAR Cutoff = MAX('Date'[Date]): hired on or before the cutoff and not left before it.

Task 1: departments into the model

Task The HR data is loaded, but Employee is not connected to Department yet. That is why every department shows the same number of absence days. Connect Employee to Department on DepartmentID.

Employee 46 rows, 8 columns
EmployeeIDNameDepartmentIDHireDateLeaveDateSalaryEmploymentTypeStatus
101Sophie Lang11 Oct 202051500Full-timeActive
102Noah Walker11 Nov 202529600Part-timeActive
103Sophie Hayes11 Sep 202654100Full-timeActive
104Sam Price11 Aug 202460300Full-timeActive
105Ben Price11 Mar 201831 May 202666600Full-timeLeft
106Olivia Hughes11 Apr 202066000Full-timeActive
107Ben Bennett21 Nov 201244000Part-timeActive
108Jack Hughes21 Feb 201647600Full-timeActive
109Ben Hayes21 Apr 202131 Aug 202551000Full-timeLeft
110Lucy Clarke21 Oct 201957700Full-timeActive
111Ravi Ali21 Jul 202231 Mar 202548700Full-timeLeft
112Ben Foster21 Mar 201952100Full-timeActive

Showing the first 12 of 46 rows.

Department 6 rows, 3 columns
DepartmentIDDepartmentDivision
1AdministrationAdministration
2SalesSales
3ProductionOperations
4LogisticsOperations
5ITAdministration
6Customer ServiceSales
Absence 486 rows, 5 columns
AbsenceIDDateEmployeeIDTypeDays
11 Jan 2025111Sick leave2
22 Jan 2025101Vacation9
33 Jan 2025127Sick leave4
43 Jan 2025127Sick leave10
54 Jan 2025142Sick leave2
66 Jan 2025104Sick leave4
76 Jan 2025118Vacation3
87 Jan 2025124Sick leave4
97 Jan 2025134Vacation6
1012 Jan 2025113Vacation7
1115 Jan 2025115Sick leave4
1216 Jan 2025117Sick leave2

Showing the first 12 of 486 rows.

Measures: [Absence Days]

Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

Showing the first 12 of 730 rows.

Department filters Employee, Employee filters Absence. The lesson on relationships shows how relationships pass on the filter.

Task 2: active employees

Task How many people work in each department today? Create the measure "Active Employees": the number of rows in Employee whose leave date is blank.

Employee 46 rows, 8 columns
EmployeeIDNameDepartmentIDHireDateLeaveDateSalaryEmploymentTypeStatus
101Sophie Lang11 Oct 202051500Full-timeActive
102Noah Walker11 Nov 202529600Part-timeActive
103Sophie Hayes11 Sep 202654100Full-timeActive
104Sam Price11 Aug 202460300Full-timeActive
105Ben Price11 Mar 201831 May 202666600Full-timeLeft
106Olivia Hughes11 Apr 202066000Full-timeActive
107Ben Bennett21 Nov 201244000Part-timeActive
108Jack Hughes21 Feb 201647600Full-timeActive
109Ben Hayes21 Apr 202131 Aug 202551000Full-timeLeft
110Lucy Clarke21 Oct 201957700Full-timeActive
111Ravi Ali21 Jul 202231 Mar 202548700Full-timeLeft
112Ben Foster21 Mar 201952100Full-timeActive

Showing the first 12 of 46 rows.

Department 6 rows, 3 columns
DepartmentIDDepartmentDivision
1AdministrationAdministration
2SalesSales
3ProductionOperations
4LogisticsOperations
5ITAdministration
6Customer ServiceSales
Absence 486 rows, 5 columns
AbsenceIDDateEmployeeIDTypeDays
11 Jan 2025111Sick leave2
22 Jan 2025101Vacation9
33 Jan 2025127Sick leave4
43 Jan 2025127Sick leave10
54 Jan 2025142Sick leave2
66 Jan 2025104Sick leave4
76 Jan 2025118Vacation3
87 Jan 2025124Sick leave4
97 Jan 2025134Vacation6
1012 Jan 2025113Vacation7
1115 Jan 2025115Sick leave4
1216 Jan 2025117Sick leave2

Showing the first 12 of 486 rows.

Measures: [Absence Days]

Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

Showing the first 12 of 730 rows.

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

The first exercise in this lesson is free.

The number is the current state of the data: anyone with a leave date does not count. The measure has no cutoff date: in a matrix by month every month would show the same number. For time series you need task 3.

Task 3: headcount at month end

Task For the monthly line you need the headcount at month end. Create the measure "Headcount": everyone who has joined by the last day of the period (hire date on or before the cutoff) and has not left yet (leave date blank or after the cutoff). Store the cutoff in a variable.

Employee 46 rows, 8 columns
EmployeeIDNameDepartmentIDHireDateLeaveDateSalaryEmploymentTypeStatus
101Sophie Lang11 Oct 202051500Full-timeActive
102Noah Walker11 Nov 202529600Part-timeActive
103Sophie Hayes11 Sep 202654100Full-timeActive
104Sam Price11 Aug 202460300Full-timeActive
105Ben Price11 Mar 201831 May 202666600Full-timeLeft
106Olivia Hughes11 Apr 202066000Full-timeActive
107Ben Bennett21 Nov 201244000Part-timeActive
108Jack Hughes21 Feb 201647600Full-timeActive
109Ben Hayes21 Apr 202131 Aug 202551000Full-timeLeft
110Lucy Clarke21 Oct 201957700Full-timeActive
111Ravi Ali21 Jul 202231 Mar 202548700Full-timeLeft
112Ben Foster21 Mar 201952100Full-timeActive

Showing the first 12 of 46 rows.

Department 6 rows, 3 columns
DepartmentIDDepartmentDivision
1AdministrationAdministration
2SalesSales
3ProductionOperations
4LogisticsOperations
5ITAdministration
6Customer ServiceSales
Absence 486 rows, 5 columns
AbsenceIDDateEmployeeIDTypeDays
11 Jan 2025111Sick leave2
22 Jan 2025101Vacation9
33 Jan 2025127Sick leave4
43 Jan 2025127Sick leave10
54 Jan 2025142Sick leave2
66 Jan 2025104Sick leave4
76 Jan 2025118Vacation3
87 Jan 2025124Sick leave4
97 Jan 2025134Vacation6
1012 Jan 2025113Vacation7
1115 Jan 2025115Sick leave4
1216 Jan 2025117Sick leave2

Showing the first 12 of 486 rows.

Measures: [Absence Days]

Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

Showing the first 12 of 730 rows.

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

The first exercise in this lesson is free.

The lesson on variables explains how VAR works. In the March row the cutoff is 31 March, in the total row 31 December. Someone who leaves on the cutoff date no longer counts; that way the headcount on 31 December is the same as on 1 January of the next year.

Common mistakes

COUNTROWS without a filter

COUNTROWS(Employee) counts all 46 people, including those who left.

No parentheses around the OR

Without parentheses && binds more tightly than ||, so the condition checks something else: a leave date after the cutoff then counts even when the hire date is after the cutoff too. The parentheses belong around ISBLANK(…) || Employee[LeaveDate] > Cutoff.

In real Power BI

  • HR systems often deliver a monthly snapshot with every person per cutoff date. Then the headcount is simply COUNTROWS per month. With only one employee table, as here, the measure calculates every cutoff date itself.
  • For headcount in full-time equivalents (FTE) you replace COUNTROWS with a sum of contracted hours divided by full-time hours.

Check your result

  • Task 1: After the relationship every department has its own absence days; Production has 367 in 2026.
  • Task 2: 37 people are active, 12 of them in Production and 4 in Customer Service.
  • Task 3: The headcount rises from 34 in January 2026 to 38 in September and is 37 in December.

Next: case 2, new hires and leavers

Who joined and who left: two measures that work for any period.

Go to case 2

Back to the course overview.

Write to us

Choose language

Select your preferred language