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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Automatically Create Unique Product ID

Hello all...

I'm hoping someone can help me understand how to create a calculated column that creates a unique Product ID for each item in my source data. My data contains multiple rows for each product. I'm thinking I need to use RANKX and/or the Index function in Power Query.

 

Thanks in advance to anyone who can help!

 

Capture.JPG

 

1 ACCEPTED SOLUTION
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

If you want to generate the unique ID like following,

 

Item Product ID
Apple 1
Apple 1
Banana 2
Banana 2
Candy 3
Candy 3

 

We can create a calculated column as following:

 

 

Column = 
RANKX ( 'Table', 'Table'[item],, ASC, DENSE )

 

 

6.PNG

 

But if you want a distinct ID for each row, like following table , we can add an index column in Power Query Editor:

 

Item Product ID
Apple 1
Apple 2
Banana 3
Banana 4
Candy 5
Candy 6

 

7.PNG8.PNG

 


Best regards,

 

Community Support Team _ Dong Li
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

3 REPLIES 3
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

If you want to generate the unique ID like following,

 

Item Product ID
Apple 1
Apple 1
Banana 2
Banana 2
Candy 3
Candy 3

 

We can create a calculated column as following:

 

 

Column = 
RANKX ( 'Table', 'Table'[item],, ASC, DENSE )

 

 

6.PNG

 

But if you want a distinct ID for each row, like following table , we can add an index column in Power Query Editor:

 

Item Product ID
Apple 1
Apple 2
Banana 3
Banana 4
Candy 5
Candy 6

 

7.PNG8.PNG

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous ,

 

you can add an Index Column in Power Query

 

Index Column.png

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


JarroVGIT
Resident Rockstar
Resident Rockstar

Adding a calculated column with a RANKX() would do the trick I think, but the product ID could change upon data refresh of course.
CalcCulmn = RANKX(table, Table[item],,ASC, skip)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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