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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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