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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Get the subject in which students scored the max marks using DAX Power BI

Consider the Table below

IDSubjectMarks
1Maths75
1Science68
1English95
1Hindi83
1SST72
2Maths98
2Science72
2English90
2Hindi68
2SST70

 

Now i Need to find the subject in which student has scored max marks. Please help with DAX to achieve this
Expected Output

IDMax MarksSubject
195English
298Maths


 

1 ACCEPTED SOLUTION

Hi @Anonymous 

You can try this,

create a measure

maxmarks = CALCULATE( MAX('Table'[Marks]),ALLEXCEPT('Table','Table'[ID]))

then create the table below,

output table = FILTER('Table','Table'[Marks]=[maxmarks])

result

vxiaotang_0-1652423035564.png

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thanks John what if i just need to get the subject in which student scored the max marks via measure

johnt75
Super User
Super User

You can do this with a couple of measures

Top Subject = CONCATENATEX( TOPN( 1, 'Table',  'Table'[Marks]), 'Table'[Subject], ", ")

Top Marks = MAX('Table'[Marks])

In case of ties this will return a comma separated list of subjects which shared the same top marks.

Anonymous
Not applicable

Thanks John what if i just need to get the subject in which student scored the max marks via measure

Hi @Anonymous 

You can try this,

create a measure

maxmarks = CALCULATE( MAX('Table'[Marks]),ALLEXCEPT('Table','Table'[ID]))

then create the table below,

output table = FILTER('Table','Table'[Marks]=[maxmarks])

result

vxiaotang_0-1652423035564.png

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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