Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a dataset with product category as one column in the product dataset. Since i have a lot of products this column is for each of them.
Is there a simple way to give them and ID number from 1 to ... depending on how many unique combinations this column has?
Example Bike will be 1 Accessories 2 et
Category |
Bikes |
Accessories |
Clothing |
Solved! Go to Solution.
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.
Hi @Lewdis_ , Hope you are doing good.
You can achieve this using power query editor in Power BI.
you can assign unique IDs using Power Query.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Let's Connect on LinkedIn: https://www.linkedin.com/in/anmol-malviya/?originalSubdomain=in
Hey @Lewdis_ ,
in Power Query there is the function of an Index column.
But you would have to match the index then also in the fact table.
What is your data source? It would be a lot better if you could do it there, for example in the underlying relationan database.
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
Best regards
Denis
Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic
Connect with me: LinkedIn
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
74 | |
72 | |
39 | |
28 | |
27 |
User | Count |
---|---|
97 | |
97 | |
58 | |
45 | |
42 |