Forum Discussion

jake223's avatar
jake223
Helper I
5 years ago
Solved

Ranking Data

Hello,

 

I'm fairly new to PowerBi and having an issue ranking within a table visual. When I have two columns in the visual the ranking works as expected the issue is when I add additional columns to the visual the ranking list all 1's. Any help would be greatly appreciated.

 

Data Sources / Relationships

Employee Report 1:M Survey Data

 

Measure

Rank Average = RANKX(ALLSELECTED('Employee Report'[EENo]), [Final_Total Average],,DESC)
 
 
  • The Name column is also filtering the data (so you end up with 1s). You need to include that column too in your ALLSELECTED.

     

    Rank Average = RANKX(ALLSELECTED('Employee Report'[EENo], 'Employee Report'[Name]), [Final_Total Average],,DESC)

     

    Regards,

    Pat

     

3 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    The Name column is also filtering the data (so you end up with 1s). You need to include that column too in your ALLSELECTED.

     

    Rank Average = RANKX(ALLSELECTED('Employee Report'[EENo], 'Employee Report'[Name]), [Final_Total Average],,DESC)

     

    Regards,

    Pat

     

    • jake223's avatar
      jake223
      Helper I

      Thank you mahoneypat 

       

      can't believe I missed that, I updated my measure and it worked. 

      RANKX(ALLSELECTED('Employee Data'), [Final_Total Average],,DESC)
       
      Followup question:
      I'm also looking for a second ranking measure to be the overall rank and not change when filters are applied, any idea how I could do that?
       
      Example:
      EENoNameAverageFilter Rank

      Overall Rank

      1John1.11

      1

      2Steve1.02

      2

      3Emily.23

      3

  • FrankAT's avatar
    FrankAT
    Community Champion

    Hi jake223 

    you can do it like this:

     

     With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
    FrankAT (Proud to be a Datanaut)