Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

DAX for max marks

Hi,

 

 

See above dataset. I want the name of the student with max marks by each subject on 3 KPI cards.

I want to do this without using the filter shelf. How can I acheive the same using dax?

  • If you unpivot your data, you could do this with only one measure and one visual.  If not, here is one example measure you can reproduce for the other two.  This will show multiple names if there is a tie for highest score.  Replace Table with your actual table name, and adapt it with the other subjects for those two measures.

     

    Top Math = var vMax = MAX(Table[Maths])
    Return CONCATENATEX(FILTER(Table, Table[Maths] = vMax), Table[Name], ", ")

     

    Regards,

    Pat

1 Reply

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    If you unpivot your data, you could do this with only one measure and one visual.  If not, here is one example measure you can reproduce for the other two.  This will show multiple names if there is a tie for highest score.  Replace Table with your actual table name, and adapt it with the other subjects for those two measures.

     

    Top Math = var vMax = MAX(Table[Maths])
    Return CONCATENATEX(FILTER(Table, Table[Maths] = vMax), Table[Name], ", ")

     

    Regards,

    Pat