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

Be 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

Reply
Florex
Frequent Visitor

Duplicate Record and change one value

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:

 

ProductIDold_ID
Cola123ABC
Fanta888DEF
Sprite777GHF

 

 

What it should look like:

 

ProductIDold_ID
Cola

123

ABC
ColaABCABC
Fanta888DEF
FantaDEFDEF
Sprite777GHF
SpriteGHF

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

2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

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.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

v-junyant-msft
Community Support
Community Support

Hi @Florex ,

@danextian Good Answer! And you can also achieve this by Unpivoted in Power Query:
Duplicate the original table first:

vjunyantmsft_0-1710471885986.png

And in the new table Table(2), select column ID and old_ID and choose "Unpivot Only Selected Columns":

vjunyantmsft_1-1710471941400.png

Then choose "Merge Queries as New" in Table(2):

vjunyantmsft_2-1710472007862.png

vjunyantmsft_3-1710472088749.png

The output is as below:

vjunyantmsft_4-1710472116217.png

Follow the diagram below to set up and delete the column Attribute:

vjunyantmsft_5-1710472156835.png

And the final output is as below:

vjunyantmsft_6-1710472206069.png

vjunyantmsft_7-1710472263503.png

 


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.

View solution in original post

2 REPLIES 2
v-junyant-msft
Community Support
Community Support

Hi @Florex ,

@danextian Good Answer! And you can also achieve this by Unpivoted in Power Query:
Duplicate the original table first:

vjunyantmsft_0-1710471885986.png

And in the new table Table(2), select column ID and old_ID and choose "Unpivot Only Selected Columns":

vjunyantmsft_1-1710471941400.png

Then choose "Merge Queries as New" in Table(2):

vjunyantmsft_2-1710472007862.png

vjunyantmsft_3-1710472088749.png

The output is as below:

vjunyantmsft_4-1710472116217.png

Follow the diagram below to set up and delete the column Attribute:

vjunyantmsft_5-1710472156835.png

And the final output is as below:

vjunyantmsft_6-1710472206069.png

vjunyantmsft_7-1710472263503.png

 


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.

danextian
Super User
Super User

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.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.