Case 5: salary structure
Before the pay review, management wants to know where salaries sit in each department. You calculate average and median and add years of service as a column.
In short: AVERAGE(Employee[Salary]) and MEDIAN(Employee[Salary]) are two measures. If the average is clearly above the median, a few high salaries pull it up. Years of service come from DATEDIFF(Employee[HireDate], DATE(2026, 12, 31), YEAR) as a column.
Task 1: average salary
Task For the pay review: create the measure "Avg Salary", the average of Employee[Salary]. The matrix is already filtered to active full-time staff, so part-time salaries do not pull the average down.
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.
The matrix is filtered to active full-time staff. Without that filter, part-time salaries and old salaries of leavers would distort the average. The lesson on measures covers measures with one aggregation.
Task 2: median
Task A single high salary shifts the average. Create the measure "Median Salary": the middle salary, with half above and half below.
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.
Measures: [Avg Salary]
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.
In Sales the average is above the median because one person earns clearly more than the others. For the question "What does a typical person here earn?" the median is the more honest number.
Task 3: years of service
Task For service awards and the pay structure: create the calculated column "Years of Service" in Employee: the years between the hire date and the cutoff date 31 December 2026, using DATEDIFF.
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.
Years of service belong to each person and do not change with the filter, so they are a calculated column. With it you can group salaries by years of service or find work anniversaries.
Common mistakes
SUM instead of AVERAGE
The sum shows the payroll cost of the department, not the typical salary. Both are useful, but they are not the same.
DATEDIFF with TODAY()
DATEDIFF with YEAR counts year boundaries, not full years. With 31 December as the cutoff that is the same thing. With TODAY() in November, someone hired in December 2025 would already have one year of service although only eleven months have passed. On top of that, the column changes with every refresh.
In real Power BI
- Salaries are confidential. A salary report belongs in its own workspace with few people who have access, or behind a role as in case 6.
- In small groups an average reveals individual salaries. Many companies only show values from a minimum number of people, for example with
IF(COUNTROWS(Employee) < 5, BLANK(), …). - To compare with part-time staff you convert salaries to full-time. For that the table needs the contracted hours.
Check your result
- Task 1: The highest average is in IT with 71,350, the lowest in Customer Service with 43,475.
- Task 2: In Sales the average is 57,020 and the median 54,300.
- Task 3: Noah Walker (hired 1 Nov 2025) has 1 year of service, Leo Reed (hired 1 Jan 2012) has 14.
Back to case 4 or the course overview.