Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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!
Solved! Go to Solution.
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 )
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 |
Best regards,
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 )
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 |
Best regards,
Hi @Anonymous ,
you can add an Index Column in Power Query
If I answered 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
Proud to be a Super User!