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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Tome_05
Helper III
Helper III

How to display duplicate data

Thank you as always.

The attached image shows the number "8" in a red box, but how can I display the data in that row as 8 duplicates?

Please let me know.2.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Tome_05 ,

 

Thanks for reaching out to us.

This is a common question, and it can be implemented in Power Query Editor.

You can refer to the method in this post.

powerquery - Power Query: Duplicate Rows Based on Value - Stack Overflow

Here's the code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJRitWJVnICsozALGcgy1gpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ColA = _t, Stock = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ColA", type text}, {"Stock", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Col", each List.Repeat({[ColA]},[Stock])), //Adds a column with lists, repeating ColA based on Stock.
    #"Expanded Col" = Table.ExpandListColumn(#"Added Custom", "Col") //Expands the lists into individual rows.
in
    #"Expanded Col"

Or you can download my attachment for more details.

 

Best Regards,
Stephen 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

3 REPLIES 3
Anonymous
Not applicable

Hi @Tome_05 ,

 

Thanks for reaching out to us.

This is a common question, and it can be implemented in Power Query Editor.

You can refer to the method in this post.

powerquery - Power Query: Duplicate Rows Based on Value - Stack Overflow

Here's the code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJRitWJVnICsozALGcgy1gpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ColA = _t, Stock = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ColA", type text}, {"Stock", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Col", each List.Repeat({[ColA]},[Stock])), //Adds a column with lists, repeating ColA based on Stock.
    #"Expanded Col" = Table.ExpandListColumn(#"Added Custom", "Col") //Expands the lists into individual rows.
in
    #"Expanded Col"

Or you can download my attachment for more details.

 

Best Regards,
Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Uzi2019
Super User
Super User

Hi @Tome_05 

Please share expected output as well..

 

You query is not clear like you want 8888 or you want to have duplicate row like 2 rows of 8???

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please look at the attached Excel image.
The idea is that if it displays 8 as in the attached image, then 8 pieces of data will be duplicated.
If the number is 4, I would like it to display 4 duplicate pieces of data.スクリーンショット 2025-01-27 165107.png

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

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

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.