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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
SBC
Helper III
Helper III

How to Generate Unique Ranks in Power BI Table Visual

Hello Community,

I am working on a Power BI report where I need to generate unique ranks in a table visual. The ranking is based on a measure from one table (Table2) and a column from another table (Table1). Below is the detailed scenario:

  • Table1 contains the UserID column.
  • Table2 contains session data, and I have created a measure called [Sessions] that calculates the number of sessions for each user.
  • There is an established relationship between UserID in Table1 and the session data in Table2.

Requirements:

  1. I want to rank users based on the [Sessions] measure in descending order, where the user with the highest session count gets rank 1.
  2. If two or more users have the same session count, they should still receive different ranks (i.e., no ties).
  3. The ranking should be dynamic and update based on filters applied in the report.
  4. The ranking should be displayed in a table visual.

    Sample Data:

    • Table1 (UserID):

      UserID
      Alice
      Bob
      Carol
      Dave
      Eve
    • Table2 (Sessions):
      • The [Sessions] measure calculates session duration or count for each user.

    Expected Output Table visual:

           
    UserIDSessionsRank_Sessions
    Dave      60        1
    Bob452
    Alice303
    Eve304
    Carol205
    As you can see, even though Alice and Eve have the same session count (30), they are assigned different ranks (3 and 4, respectively) to ensure uniqueness.

    Current DAX Logic:

    This is the current DAX logic I am using to generate ranks:
    text
    Rank_Sessions =   IF( ISINSCOPE('Table1'[UserID]), RANKX( ALL('Table1'), [Sessions], , DESC, DENSE ), BLANK() )

    Issue:

    This formula works for generating ranks but does not handle ties well when multiple users have the same session count. I need help modifying this logic so that when two users have identical session counts, they are still assigned different ranks (i.e., no ties).Any suggestions or improvements would be greatly appreciated!Thanks,SBC
1 ACCEPTED SOLUTION
ThxAlot
Super User
Super User

ThxAlot_0-1730925377535.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

4 REPLIES 4
ThxAlot
Super User
Super User

ThxAlot_0-1730925377535.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



sbezawada
Frequent Visitor

Hi @SBC ,
Try by using this way like by replacing rank with rownumber, i hope it works 

sbezawada_0-1730885819842.png

 

Hi @sbezawada ,

 thanks for responding. The session is actually a measure from one table2, and the user ID is from a different table, which is a column in Table 1. I'm having trouble applying the logic you provided.

 

sbezawada
Frequent Visitor

Then you can merge the two tables on User ID and then apply the dax which i shared
or
else use the related function and try adding the sessions column into table 1 and then apply it will works for you (link for how to apply related : https://youtu.be/8YJyALHRKRY?si=kVrp91C110j6u34d)
Hope it will work for you
or else explain it clearly what you are not getting then i will help you

Helpful resources

Announcements
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.

Top Solution Authors