Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
malay1803
Frequent Visitor

How to get maximum salary, name of employee with maximum salary and department in power bi

Hey, I am new to power bi, and still learning. I want to know how to get maximum salary, name of employee with maximum salary and department in power bi? I want to show the data in tabular form.

1 ACCEPTED SOLUTION

Hi Have corrected the measure try this one:

MaxSalaryName =
CALCULATE (
    MAX ( 'Sheet5'[Name] ),
    FILTER (
        'Sheet5',
        'Sheet5'[Salary] = MAX ( 'Sheet5'[Salary] )
    )
) and 
max salary = MAX(Sheet5[Salary])
here is my output hope this should work
qqqqqwwwweeerrr_0-1713072609348.png

Regards

View solution in original post

8 REPLIES 8
SAMEERAHMAD
New Member

Hi, when I tried the same only for the name & max salary...it's getting me the max of name, means in sorted order ex name starting with Z***** against the salary

qqqqqwwwweeerrr
Super User
Super User

Hi @malay1803 

 

Based on input data here is my approach to finding max salary and name for a given department 

 

you need to create two measure:

1. max salary = MAX(Sheet4[Salary])

MaxSalaryName =
CALCULATE(
    MAX('Sheet4'[Name]),
    FILTER(
        'Sheet4',
        'Sheet4'[Salary] = [max salary]
    )
)
this is my output
qqqqqwwwweeerrr_0-1713023683190.png

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Check for more intersing solution here: www.youtube.com/@Howtosolveprobem

Regards

 

Hey, thanks for replying.
I tried this code, but the name which is being returned is the last name available for that dept.
So if the data goes like this:

NameDeptSalary
A13500
B14300
C12200
D21200
E23240
F36300
G32319
H31200


then the output should be 

NameDeptSalary
B14300
E23240
F36300


But using the measure/query provided by you. It is returning

NameDeptSalary
C14300
E23240
H38200

Hi Have corrected the measure try this one:

MaxSalaryName =
CALCULATE (
    MAX ( 'Sheet5'[Name] ),
    FILTER (
        'Sheet5',
        'Sheet5'[Salary] = MAX ( 'Sheet5'[Salary] )
    )
) and 
max salary = MAX(Sheet5[Salary])
here is my output hope this should work
qqqqqwwwweeerrr_0-1713072609348.png

Regards

Heyy, This WORKED! Thanks alot! Big Help!

PhilipTreacy
Super User
Super User

Hi @malay1803 

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

Please supply some data and an example of the desired result.

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hey Phil, Thanks for replying. As the data is quite huge, below is a dummy data.

NameDeptSalary
A13500
B12200
C14300
D21200
E23240
F36300
G32319
H38200


I want the below desired output.

NameDeptSalary
C14300
E23240
H38200

Hi,

These measures work

Max salary = MAX(Data[Salary])
Highest earner = CALCULATE(MAX(Data[Name]),FILTER(Data,Data[Salary]=[Max salary]))

Hope this helps.

Ashish_Mathur_0-1713051969569.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.