Forum Discussion
Anonymous
6 years agoNot 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 pro...
- 6 years ago
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,
v-lid-msft
6 years agoCommunity 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 )
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,