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
| EmployeeID | Name | DepartmentID | HireDate | LeaveDate | Salary | EmploymentType | Status |
|---|---|---|---|---|---|---|---|
| 101 | Sophie Lang | 1 | 1 Oct 2020 | 51500 | Full-time | Active | |
| 102 | Noah Walker | 1 | 1 Nov 2025 | 29600 | Part-time | Active | |
| 103 | Sophie Hayes | 1 | 1 Sep 2026 | 54100 | Full-time | Active | |
| 104 | Sam Price | 1 | 1 Aug 2024 | 60300 | Full-time | Active | |
| 105 | Ben Price | 1 | 1 Mar 2018 | 31 May 2026 | 66600 | Full-time | Left |
| 106 | Olivia Hughes | 1 | 1 Apr 2020 | 66000 | Full-time | Active | |
| 107 | Ben Bennett | 2 | 1 Nov 2012 | 44000 | Part-time | Active | |
| 108 | Jack Hughes | 2 | 1 Feb 2016 | 47600 | Full-time | Active | |
| 109 | Ben Hayes | 2 | 1 Apr 2021 | 31 Aug 2025 | 51000 | Full-time | Left |
| 110 | Lucy Clarke | 2 | 1 Oct 2019 | 57700 | Full-time | Active | |
| 111 | Ravi Ali | 2 | 1 Jul 2022 | 31 Mar 2025 | 48700 | Full-time | Left |
| 112 | Ben Foster | 2 | 1 Mar 2019 | 52100 | Full-time | Active |
Showing the first 12 of 46 rows.
Department 6 rows, 3 columns
| DepartmentID | Department | Division |
|---|---|---|
| 1 | Administration | Administration |
| 2 | Sales | Sales |
| 3 | Production | Operations |
| 4 | Logistics | Operations |
| 5 | IT | Administration |
| 6 | Customer Service | Sales |
Absence 486 rows, 5 columns
| AbsenceID | Date | EmployeeID | Type | Days |
|---|---|---|---|---|
| 1 | 1 Jan 2025 | 111 | Sick leave | 2 |
| 2 | 2 Jan 2025 | 101 | Vacation | 9 |
| 3 | 3 Jan 2025 | 127 | Sick leave | 4 |
| 4 | 3 Jan 2025 | 127 | Sick leave | 10 |
| 5 | 4 Jan 2025 | 142 | Sick leave | 2 |
| 6 | 6 Jan 2025 | 104 | Sick leave | 4 |
| 7 | 6 Jan 2025 | 118 | Vacation | 3 |
| 8 | 7 Jan 2025 | 124 | Sick leave | 4 |
| 9 | 7 Jan 2025 | 134 | Vacation | 6 |
| 10 | 12 Jan 2025 | 113 | Vacation | 7 |
| 11 | 15 Jan 2025 | 115 | Sick leave | 4 |
| 12 | 16 Jan 2025 | 117 | Sick leave | 2 |
Showing the first 12 of 486 rows.
Measures: [Absence Days]
Date 730 rows, 4 columns
| Date | Year | Month | MonthName |
|---|---|---|---|
| 1 Jan 2025 | 2025 | 1 | Jan |
| 2 Jan 2025 | 2025 | 1 | Jan |
| 3 Jan 2025 | 2025 | 1 | Jan |
| 4 Jan 2025 | 2025 | 1 | Jan |
| 5 Jan 2025 | 2025 | 1 | Jan |
| 6 Jan 2025 | 2025 | 1 | Jan |
| 7 Jan 2025 | 2025 | 1 | Jan |
| 8 Jan 2025 | 2025 | 1 | Jan |
| 9 Jan 2025 | 2025 | 1 | Jan |
| 10 Jan 2025 | 2025 | 1 | Jan |
| 11 Jan 2025 | 2025 | 1 | Jan |
| 12 Jan 2025 | 2025 | 1 | Jan |
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
| EmployeeID | Name | DepartmentID | HireDate | LeaveDate | Salary | EmploymentType | Status |
|---|---|---|---|---|---|---|---|
| 101 | Sophie Lang | 1 | 1 Oct 2020 | 51500 | Full-time | Active | |
| 102 | Noah Walker | 1 | 1 Nov 2025 | 29600 | Part-time | Active | |
| 103 | Sophie Hayes | 1 | 1 Sep 2026 | 54100 | Full-time | Active | |
| 104 | Sam Price | 1 | 1 Aug 2024 | 60300 | Full-time | Active | |
| 105 | Ben Price | 1 | 1 Mar 2018 | 31 May 2026 | 66600 | Full-time | Left |
| 106 | Olivia Hughes | 1 | 1 Apr 2020 | 66000 | Full-time | Active | |
| 107 | Ben Bennett | 2 | 1 Nov 2012 | 44000 | Part-time | Active | |
| 108 | Jack Hughes | 2 | 1 Feb 2016 | 47600 | Full-time | Active | |
| 109 | Ben Hayes | 2 | 1 Apr 2021 | 31 Aug 2025 | 51000 | Full-time | Left |
| 110 | Lucy Clarke | 2 | 1 Oct 2019 | 57700 | Full-time | Active | |
| 111 | Ravi Ali | 2 | 1 Jul 2022 | 31 Mar 2025 | 48700 | Full-time | Left |
| 112 | Ben Foster | 2 | 1 Mar 2019 | 52100 | Full-time | Active |
Showing the first 12 of 46 rows.
Department 6 rows, 3 columns
| DepartmentID | Department | Division |
|---|---|---|
| 1 | Administration | Administration |
| 2 | Sales | Sales |
| 3 | Production | Operations |
| 4 | Logistics | Operations |
| 5 | IT | Administration |
| 6 | Customer Service | Sales |
Absence 486 rows, 5 columns
| AbsenceID | Date | EmployeeID | Type | Days |
|---|---|---|---|---|
| 1 | 1 Jan 2025 | 111 | Sick leave | 2 |
| 2 | 2 Jan 2025 | 101 | Vacation | 9 |
| 3 | 3 Jan 2025 | 127 | Sick leave | 4 |
| 4 | 3 Jan 2025 | 127 | Sick leave | 10 |
| 5 | 4 Jan 2025 | 142 | Sick leave | 2 |
| 6 | 6 Jan 2025 | 104 | Sick leave | 4 |
| 7 | 6 Jan 2025 | 118 | Vacation | 3 |
| 8 | 7 Jan 2025 | 124 | Sick leave | 4 |
| 9 | 7 Jan 2025 | 134 | Vacation | 6 |
| 10 | 12 Jan 2025 | 113 | Vacation | 7 |
| 11 | 15 Jan 2025 | 115 | Sick leave | 4 |
| 12 | 16 Jan 2025 | 117 | Sick leave | 2 |
Showing the first 12 of 486 rows.
Measures: [Absence Days]
Date 730 rows, 4 columns
| Date | Year | Month | MonthName |
|---|---|---|---|
| 1 Jan 2025 | 2025 | 1 | Jan |
| 2 Jan 2025 | 2025 | 1 | Jan |
| 3 Jan 2025 | 2025 | 1 | Jan |
| 4 Jan 2025 | 2025 | 1 | Jan |
| 5 Jan 2025 | 2025 | 1 | Jan |
| 6 Jan 2025 | 2025 | 1 | Jan |
| 7 Jan 2025 | 2025 | 1 | Jan |
| 8 Jan 2025 | 2025 | 1 | Jan |
| 9 Jan 2025 | 2025 | 1 | Jan |
| 10 Jan 2025 | 2025 | 1 | Jan |
| 11 Jan 2025 | 2025 | 1 | Jan |
| 12 Jan 2025 | 2025 | 1 | Jan |
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
| EmployeeID | Name | DepartmentID | HireDate | LeaveDate | Salary | EmploymentType | Status |
|---|---|---|---|---|---|---|---|
| 101 | Sophie Lang | 1 | 1 Oct 2020 | 51500 | Full-time | Active | |
| 102 | Noah Walker | 1 | 1 Nov 2025 | 29600 | Part-time | Active | |
| 103 | Sophie Hayes | 1 | 1 Sep 2026 | 54100 | Full-time | Active | |
| 104 | Sam Price | 1 | 1 Aug 2024 | 60300 | Full-time | Active | |
| 105 | Ben Price | 1 | 1 Mar 2018 | 31 May 2026 | 66600 | Full-time | Left |
| 106 | Olivia Hughes | 1 | 1 Apr 2020 | 66000 | Full-time | Active | |
| 107 | Ben Bennett | 2 | 1 Nov 2012 | 44000 | Part-time | Active | |
| 108 | Jack Hughes | 2 | 1 Feb 2016 | 47600 | Full-time | Active | |
| 109 | Ben Hayes | 2 | 1 Apr 2021 | 31 Aug 2025 | 51000 | Full-time | Left |
| 110 | Lucy Clarke | 2 | 1 Oct 2019 | 57700 | Full-time | Active | |
| 111 | Ravi Ali | 2 | 1 Jul 2022 | 31 Mar 2025 | 48700 | Full-time | Left |
| 112 | Ben Foster | 2 | 1 Mar 2019 | 52100 | Full-time | Active |
Showing the first 12 of 46 rows.
Department 6 rows, 3 columns
| DepartmentID | Department | Division |
|---|---|---|
| 1 | Administration | Administration |
| 2 | Sales | Sales |
| 3 | Production | Operations |
| 4 | Logistics | Operations |
| 5 | IT | Administration |
| 6 | Customer Service | Sales |
Absence 486 rows, 5 columns
| AbsenceID | Date | EmployeeID | Type | Days |
|---|---|---|---|---|
| 1 | 1 Jan 2025 | 111 | Sick leave | 2 |
| 2 | 2 Jan 2025 | 101 | Vacation | 9 |
| 3 | 3 Jan 2025 | 127 | Sick leave | 4 |
| 4 | 3 Jan 2025 | 127 | Sick leave | 10 |
| 5 | 4 Jan 2025 | 142 | Sick leave | 2 |
| 6 | 6 Jan 2025 | 104 | Sick leave | 4 |
| 7 | 6 Jan 2025 | 118 | Vacation | 3 |
| 8 | 7 Jan 2025 | 124 | Sick leave | 4 |
| 9 | 7 Jan 2025 | 134 | Vacation | 6 |
| 10 | 12 Jan 2025 | 113 | Vacation | 7 |
| 11 | 15 Jan 2025 | 115 | Sick leave | 4 |
| 12 | 16 Jan 2025 | 117 | Sick leave | 2 |
Showing the first 12 of 486 rows.
Measures: [Absence Days]
Date 730 rows, 4 columns
| Date | Year | Month | MonthName |
|---|---|---|---|
| 1 Jan 2025 | 2025 | 1 | Jan |
| 2 Jan 2025 | 2025 | 1 | Jan |
| 3 Jan 2025 | 2025 | 1 | Jan |
| 4 Jan 2025 | 2025 | 1 | Jan |
| 5 Jan 2025 | 2025 | 1 | Jan |
| 6 Jan 2025 | 2025 | 1 | Jan |
| 7 Jan 2025 | 2025 | 1 | Jan |
| 8 Jan 2025 | 2025 | 1 | Jan |
| 9 Jan 2025 | 2025 | 1 | Jan |
| 10 Jan 2025 | 2025 | 1 | Jan |
| 11 Jan 2025 | 2025 | 1 | Jan |
| 12 Jan 2025 | 2025 | 1 | Jan |
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.
Back to the course overview.