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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mclarke
New Member

Assign to each unique value a number

Hi guys,

I'm trying to assign a numerical code (consecutive ideally but not necessarily) for each unique value from a column. Is there a way to do this?

 

I hope you can help me!!

1 ACCEPTED SOLUTION

@mclarke 

 

Like this ?

ribisht17_0-1653066674488.png

 

Please use this >>> 

RANKXC = RANKX(Sheet4,Sheet4[Category],(Sheet4[Category]))
 
Regards,
Ritesh

 

View solution in original post

5 REPLIES 5
ribisht17
Super User
Super User

@mclarke 

 

Please post some sample data here

 

Regards,

Ritesh

ribisht17
Super User
Super User

@mclarke 

 

You can definitely add INDEX column 

 

Solved: Rank for unique values - Microsoft Power BI Community

 

ribisht17_0-1653061100952.png

 

 

Regards,

Ritesh

Thank you for answering. This generates a new value for each row, I need only new numbers on new values

@mclarke 

 

Like this ?

ribisht17_0-1653066674488.png

 

Please use this >>> 

RANKXC = RANKX(Sheet4,Sheet4[Category],(Sheet4[Category]))
 
Regards,
Ritesh

 

Thank you! I've sorted it another way (duplicated column in another table, removed duplicates and indexed), but this is even better.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors