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
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.

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
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.

Measures: [Avg Salary]

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.

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
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.

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.

Next: case 6, HR report with a role

Every division head sees only their departments, plus the part-time rate and a title with the division.

Go to case 6

Back to case 4 or the course overview.

Write to us

Choose language

Select your preferred language