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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Mahendran_C_S
Helper I
Helper I

Generate Unique id for columns and replicate is of these columns in other tables

I have a requirement to generate a unique id for a column in a table and that column is also present in another table where the generated unique id should replicate in another table too.

 

For example, I have a product table : 

 

I want to generate a unique id for the column product id

 

Generated IDProduct IDProduct NameCategory
1FUR-BO-10001798Bush Somerset Collection BookcaseFurniture
2TEC-PH-10002275Mitel 5320 IP Phone VoIP phonePhones

 

I have another table called Orders where it had product ID where the product ID is repeated :

I want the ID generated for product ID in product table has to be the same in generated ID for product ID in the orders column too.

 

DateProduct IDGenerated ID for Product IDProduct NameSalesCustomer ID
09-11-2013FUR-BO-100017981Bush Somerset Collection Bookcase3000CG-12520
09-11-2013FUR-BO-100017981Bush Somerset Collection Bookcase6000SO-20335
09-11-2013TEC-PH-100022752Mitel 5320 IP Phone VoIP phone2400SO-20335
09-12-2013TEC-PH-100022752Mitel 5320 IP Phone VoIP phone4800BH-11710

 

 

Even though product ID is unique in the product column, the purpose of generating generated columns in numbers is to increase the performance while searching or linking the tables. The actual product table contains a 13 digits unique string where it reduces the performance.

Could anyone please help me in finding the solution for the above requirement? Thanks in advance.

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @Mahendran_C_S ,

 

A bit of a left-field idea, but you could convert your product ID's to Unicode or some other format.

To convert to Unicode in Power Query, you would do something like this in a new custom column:

List.Transform(Text.ToList([Product ID]), each Character.ToNumber(_))

 

Unfortunately, this produces numerical outputs too large for the Int.64 data type, but you could change data type to decimal and it may work for you.

 

I get the following output:

BA_Pete_0-1632833274337.png

 

As I said, a strange idea, but hopefully gives you a new perspective on possible solutions.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

4 REPLIES 4
BA_Pete
Super User
Super User

Hi @Mahendran_C_S ,

 

A bit of a left-field idea, but you could convert your product ID's to Unicode or some other format.

To convert to Unicode in Power Query, you would do something like this in a new custom column:

List.Transform(Text.ToList([Product ID]), each Character.ToNumber(_))

 

Unfortunately, this produces numerical outputs too large for the Int.64 data type, but you could change data type to decimal and it may work for you.

 

I get the following output:

BA_Pete_0-1632833274337.png

 

As I said, a strange idea, but hopefully gives you a new perspective on possible solutions.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




mahoneypat
Microsoft Employee
Microsoft Employee

You could reference your orders query, disable load, remove all but the product and product ID columns, remove duplicates, and then merge that query into your products table, and expand the Product ID column.

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


mahoneypat
Microsoft Employee
Microsoft Employee

If I understand your scenario, it seems like you could add an index column to your product table, and then create a column with those same ids in your other table via a merge, look up value with list functions, or with a DAX column with LOOKUPVALUE.

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks for the response @mahoneypat . I tried the above one it works but it compares the Product ID of the product table with the product ID in the orders table and the index occurs in the orders table. But I don't want to compare the columns because it makes high complexity in performance.

Could you suggest few other ways to generate autonumber for the specific column? There is a function called autonumber() in Qliksense which does the same requirement. Is there any alternative for that function in power bi using M language or DAX? 
Thanks in advance.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.