March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello kind community!
I want to duplicate any record in my dataset and want change one value (due to multiple relationship is not possible)
How is currently looks:
Product | ID | old_ID |
Cola | 123 | ABC |
Fanta | 888 | DEF |
Sprite | 777 | GHF |
What it should look like:
Product | ID | old_ID |
Cola | 123 | ABC |
Cola | ABC | ABC |
Fanta | 888 | DEF |
Fanta | DEF | DEF |
Sprite | 777 | GHF |
Sprite | GHF | GHF |
Background: Want to use ID column for a relationship to other table and i need old and new identifier to find all processes
Thank you
Solved! Go to Solution.
Hi @Florex
You can easily duplicate all rows of a table in the query editor by using Table.Repeat or by refererring to another t query for the list of IDs to be duplicated for selective duplication. But doing either will most likely result to a many-to-many relationship, the current table being on the many side. Please see attached pbix for reference.
Proud to be a Super User!
Hi @Florex ,
@danextian Good Answer! And you can also achieve this by Unpivoted in Power Query:
Duplicate the original table first:
And in the new table Table(2), select column ID and old_ID and choose "Unpivot Only Selected Columns":
Then choose "Merge Queries as New" in Table(2):
The output is as below:
Follow the diagram below to set up and delete the column Attribute:
And the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Florex ,
@danextian Good Answer! And you can also achieve this by Unpivoted in Power Query:
Duplicate the original table first:
And in the new table Table(2), select column ID and old_ID and choose "Unpivot Only Selected Columns":
Then choose "Merge Queries as New" in Table(2):
The output is as below:
Follow the diagram below to set up and delete the column Attribute:
And the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Florex
You can easily duplicate all rows of a table in the query editor by using Table.Repeat or by refererring to another t query for the list of IDs to be duplicated for selective duplication. But doing either will most likely result to a many-to-many relationship, the current table being on the many side. Please see attached pbix for reference.
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
167 | |
117 | |
63 | |
57 | |
50 |