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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
harshnathani
Community Champion
Community Champion

Create a Rank Index Column in Power Query

Hi Community Members,

 

I have a column ID with values  50, 70, 10, 5, 95, 100, 100, 225

 

I want to create an index column (1 - 8 )such that the lowest value in the ID column gets the value 1 and the highest in the id column gets value 8.

 

Here 5 will get index value 1, 10 will get index value 2 ........ 225 will get index value 8.

 

I can do it using rankx but want to try this in Power Query.

 

Regards,

Harsh Nathani

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @harshnathani 

 

Sure, just add 2 steps 

1. sort you values column in Ascending order.

image.png

2. Add an Index column as below, click on the small down arrow next to index column and select "from 1" or adjust the code to start from 1 after.

image.png

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

1 REPLY 1
Mariusz
Community Champion
Community Champion

Hi @harshnathani 

 

Sure, just add 2 steps 

1. sort you values column in Ascending order.

image.png

2. Add an Index column as below, click on the small down arrow next to index column and select "from 1" or adjust the code to start from 1 after.

image.png

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors
Top Kudoed Authors