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
Anonymous
Not applicable

Getting Rank of Text Column which has duplicate records

I am not sure how to mention this. I have a simple table as below. I am trying to get the rank basis on 'Name' Column which has duplicate record. Can any one help whether this can be achieved in power bi? Thanks in Advance.

NameDesired Output (Rank)
A1
A2
A3
A4
B1
B2
B3
C1
C2
C3
C4
C5
C6

 

2 ACCEPTED SOLUTIONS

Hi @Anonymous 

 

Once you've added your index column, you can use the DAX expression below to create your rank column:

Rank = 
VAR RowName = Table1[Name]
VAR Result = 
RANKX(
    FILTER(
        ALL( Table1 ),
        Table1[Name] = RowName
    ),
    Table1[Index],
    ,ASC
)
RETURN Result

 

Best regards,
Martyn

View solution in original post

Anonymous
Not applicable

Create one index column and then create one more column as below.

 

Rank = CALCULATE(COUNT('Table'[Col]),FILTER('Table','Table'[Col]=EARLIER('Table'[Col]) && 'Table'[Index]<=EARLIER('Table'[Index])))
 
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

View solution in original post

7 REPLIES 7
Tani4ka
Helper I
Helper I

I have a similar problem with ranking. What I need is to have all channel_grouping_1 have the same rank. Offline Only 1 across all lines, Direct 2 across all lines etc. Can anyone help? 

Tani4ka_0-1625044624068.png

Many thanks

az38
Community Champion
Community Champion

Hi @Anonymous 

the easiest way is to add a Custom Index Column in Power Query Editor mode

then try to create a calculated DAX column like

RANK = 
var _RowsBefore = COUNTROWS(FILTER('Table', 'Table'[Name]<EARLIER('Table'[Name])))
RETURN
rankx(FILTER('Table', 'Table'[Name]=EARLIER('Table'[Name])), 'Table'[Index],,ASC) + _RowsBefore

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hi  

 

 

Hi @Anonymous 

 

Once you've added your index column, you can use the DAX expression below to create your rank column:

Rank = 
VAR RowName = Table1[Name]
VAR Result = 
RANKX(
    FILTER(
        ALL( Table1 ),
        Table1[Name] = RowName
    ),
    Table1[Index],
    ,ASC
)
RETURN Result

 

Best regards,
Martyn

Anonymous
Not applicable

Hi @MartynRamsden 

Perfect! This answers my query. Thanks a lot for your help.

 

Regards!

Anonymous
Not applicable

Create one index column and then create one more column as below.

 

Rank = CALCULATE(COUNT('Table'[Col]),FILTER('Table','Table'[Col]=EARLIER('Table'[Col]) && 'Table'[Index]<=EARLIER('Table'[Index])))
 
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.
Anonymous
Not applicable

Hi @Anonymous 

 

Perfect, This is also a solution to my concern. Thanks a lot for your help.

 

Regards,

 

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.