Forum Discussion

Cgowdar's avatar
Cgowdar
Icon for Advocate II rankAdvocate II
8 years ago
Solved

Displaying Top 3 and Others based on dynamic ranking

The Requirement is to show the "Top 3" and "Others" in the Pie Chart.

 

Following is the sample data:

 

SubjectStudent Marks
MathsJohn50
Maths Sam60
MathsVan70
MathsJim30
Maths Jam20
MathsCan90
EnglishJohn20
EnglishSam30
EnglishVan40
EnglishJim50
EnglishJam60
EnglishCan70
FrenchJohn55
FrenchSam75
FrenchVan15
FrenchJim95
FrenchJam80
FrenchCan20

 

Subject will be the filter.

 

need to obtain Top 3 Students based on their Marks. the ranking will change for every subject choosen from the filter.

 

I have tried using RANKX Function , but not able to get to the solution.

 

Any suggestions on this will be helpfull.

 

Thanks in advance

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    Cgowdar

     

    You can also use a MEASURE. This will allow you to determine RANK when you select more than 1 subject

     

    RANK =
    RANKX (
        ALLSELECTED ( TableName[Student ] ),
        CALCULATE ( SUM ( TableName[Marks] ) ),
        ,
        DESC,
        DENSE
    )

     

     

9 Replies

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    Icon for Community Champion rankCommunity Champion

     Cgowdar

     

    How about adding a Calculated Column that will RANK students for each subject separately

     

    RANK in each Subject =
    RANKX (
        FILTER (
            ALL ( TableName ),
            TableName[Subject] = EARLIER ( TableName[Subject] )
        ),
        TableName[Marks],
        ,
        DESC,
        DENSE
    )