Forum Discussion
Create ID from values in column
- 1 year ago
Heya,
For this kind of data (e.g. Products) it is adviceable to have a dedicated table with unique values so you can easily manage relationships and other calculations. If you don't already have one, then you can create a Products table using the code below (assuming that 'Table' is your dataset table):
Products = DISTINCT(SELECTCOLUMNS('Table',"Products",'Table'[Category))Then, you can simply add a calculated index column with the code:
Index = RANKX(ALL('Products'),'Products'[Products],,ASC)Hope it helps.
Heya,
For this kind of data (e.g. Products) it is adviceable to have a dedicated table with unique values so you can easily manage relationships and other calculations. If you don't already have one, then you can create a Products table using the code below (assuming that 'Table' is your dataset table):
Products = DISTINCT(SELECTCOLUMNS('Table',"Products",'Table'[Category))
Then, you can simply add a calculated index column with the code:
Index = RANKX(ALL('Products'),'Products'[Products],,ASC)
Hope it helps.