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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.