Reply
Florex
Frequent Visitor
Partially syndicated - Outbound

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

Syndicated - Outbound

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.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"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

Syndicated - Outbound

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

Syndicated - Outbound

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

Syndicated - Outbound

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.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"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.
avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)