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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

7 REPLIES 7
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: https://www.youtube.com/@letssolveproblem

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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