Power QueryExercises

Interview task: second-highest salary per department (logistics)

For each department, return the second-highest distinct salary. Departments with only one distinct salary are left out.

Level
advanced
Time
~12 min
Task
Build the query
Access
Pro
Checking your access…

About this exercise

What you'll practise

Rank distinct values within groups and handle groups that are too small.

The scenario, sample data, step list, hints and solution open with Pro. Grading checks your query against hidden data as well as the visible sample, so a query that only fits the sample doesn't pass.

Input

  • Roster (table)
    • EmpID: text
    • FirstName: text
    • LastName: text
    • Department: text
    • City: text
    • Salary: number
    • StartDate: text
    • Manager: text (nullable)
    • Email: text

Expected output columns

Department (text), Second Salary (number)