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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
PimK
Frequent Visitor

Rank column based on other text column

Hi all,

 

See below table, where I have a column Code (text) and a column Name. The aim is to rank the column Name based on the column Code. When column Name doesn't have a unique value, take the minimum of column Code. Column Code doesn't have duplicates. Like this:

 

CodeNameRank
01.00D1
01.01D1
01.02A2
01.03B3
01.04D1
01.05B3

 

How can I achieve this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PimK ,

 

Since you don't want to change the Code column as number type. You need to first create column to return number type values.

vstephenmsft_0-1693968966512.png

Then create a column to return min code value group by name.

vstephenmsft_1-1693969413578.png

At last, create the ranking column.

vstephenmsft_2-1693969445671.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @PimK ,

 

Since you don't want to change the Code column as number type. You need to first create column to return number type values.

vstephenmsft_0-1693968966512.png

Then create a column to return min code value group by name.

vstephenmsft_1-1693969413578.png

At last, create the ranking column.

vstephenmsft_2-1693969445671.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

Thanks Stephen!

Greg_Deckler
Community Champion
Community Champion

@PimK Maybe: 

Rank = RANKX( 'Table', [Name],,,Dense )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you for the reply Greg.

 

The code you mentioned sorts on the column Name instead of the column Code.. 

The rank position for name A should be 2. Your code results in 3 as rank position for name A.

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.