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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
VladMatao
Frequent Visitor

Merge rows that are wrongly formated

Hello,

 

As you can see from the picture I have some values in column 3 which should be in one row, instead they span over multiple. That transfer for instance. Is there a way to merge them?

Annotation 2020-02-12 142448.png

 

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @VladMatao ,

 

First create a new table which only contains column 3.

Then go to edit queries>"Transform">"Transpose":

Annotation 2020-02-13 133949.pngAnnotation 2020-02-13 134030.png

 

"Add column">"Custom Column":

Annotation 2020-02-13 134030.png

Merge all the columns and use"&"to connect with them:

Annotation 2020-02-13 134313.png

Finally you will see:

Annotation 2020-02-13 134425.png

Citys which was put in multiple rows has been merged in one row.

 

Best Regards,
Kelly

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @VladMatao ,

 

First create a new table which only contains column 3.

Then go to edit queries>"Transform">"Transpose":

Annotation 2020-02-13 133949.pngAnnotation 2020-02-13 134030.png

 

"Add column">"Custom Column":

Annotation 2020-02-13 134030.png

Merge all the columns and use"&"to connect with them:

Annotation 2020-02-13 134313.png

Finally you will see:

Annotation 2020-02-13 134425.png

Citys which was put in multiple rows has been merged in one row.

 

Best Regards,
Kelly

HotChilli
Super User
Super User

I can give you a start (and it will work for your example) but you may need to alter this on a bigger dataset because it groups on the amount which isn't really a good strategy

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dZBfb4IwFMW/yg1vy5RQcE58Q+icSS1LwbjF+NDpVUmQmtK5+e3lTyRm2e5Te349997T1cqaB2mQAHEc17V6Vp94vu0P/LsCa91bWVzpo8ybF6NGmKvPLMc3eak1z200xiCUBnVW7CE4lTVxhw0RdB7UQ5xGI7b/9JcBHqr61zUc2X47O9WyKHeoodIfied69nNrWCIc5BlB4wazM27BHBB2Ks/Vdz3iJC9HLAzstDqOK2/b7JVCuBCC8vADQhYvImBpdE+TlC4DEcFkMWPRjE9vjLgdSlJBaXoDLOZRzIESGL7EPaB8ygLetYx1ts8KaZQuQWAVA4sNjoH4xCGkL5JwEr07Duk2qCKUWGyruAdZ1kfzK5bBH9PFEXhW+Zfprvdf6A2s9foK", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column3 = _t, Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type number}}),
    #"Filled Down" = Table.FillDown(#"Changed Type",{"Column1"}),
    #"Grouped Rows" = Table.Group(#"Filled Down", {"Column1"}, {{"all", each _, type table [Column3=text, Column1=number]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Column([all], "Column3")),
    #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text})
in
    #"Extracted Values"

 

Also, quick tip, post data rather than a picture.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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