Power BI DAX: Get MAX Salary per Employee (Real Interview Scenario)
Автор: Analytics with Vijay
Загружено: 2025-12-25
Просмотров: 53
In this video, I explain how to get the maximum salary row for each employee in Power BI when the same employee appears multiple times with different salaries.
This is a very common real-world and interview scenario where:
Employee names are repeated
Salaries differ
We need to return only the row(s) with the highest salary per employee
I cover:
✅ Why a measure will NOT work
✅ Why CALCULATETABLE gives an error in Boolean expressions
✅ The correct use of FILTER + CALCULATE + ALLEXCEPT
✅ Two valid DAX approaches with explanation
This logic is extremely useful in:
HR analytics
Salary analysis
De-duplication scenarios
Power BI interviews
🧠 DAX Used in This Video
✔️ Method 1: Using FILTER (Recommended & Clean)
Emp_Max_Salary =
FILTER (
Emp_Table,
Emp_Table[Salary]
=
CALCULATE (
MAX ( Emp_Table[Salary] ),
ALLEXCEPT ( Emp_Table, Emp_Table[Emp Name] )
)
)
👉 Best approach for row-by-row comparison
👉 Returns all employees with their highest salary rows
✔️ Method 2: Using CALCULATETABLE + FILTER
Emp_Max_Salary2 =
CALCULATETABLE (
Emp_Table,
FILTER (
Emp_Table,
Emp_Table[Salary]
=
CALCULATE (
MAX ( Emp_Table[Salary] ),
ALLEXCEPT ( Emp_Table, Emp_Table[Emp Name] )
)
)
)
👉 Required when using complex logic inside CALCULATETABLE
👉 Avoids the common CALCULATE-in-Boolean-expression error
🔗 Connect with me on LinkedIn: / vijay-kaushal-ai
📧 Business email: analyticswithvijay@gmail.com
If you are preparing for analytics roles like Power BI Developer, Data Analyst, or Business Intelligence Analyst, make sure to subscribe for daily practical problems.
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: