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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mglomb
Frequent Visitor

Merging Rows and Columns

I have a database where the main ID is the core (repeated) value, and each additional column has its own data.

 

I want to merge rows and columns in a way that each row has all the columns filled, and I can have a single view of each core ID.

 

What is the best way to do that?

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

Hi, @mglomb ;

You could group by in power query .

vyalanwumsft_0-1635148658703.png

The final output is shown below:

vyalanwumsft_1-1635148682559.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ0VNJRMjTQNzLUNzIwAnEgyCkxL1EhL1EpVgemCKIOpMzAEKEGXQkQWepbwMxCUmFkbAKWA9kFkQSykS31L0rMS09FUgtBFvrGMEVIKkxMzaDuNkB1d0BqYnIGmhJDrEpiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Id = _t, Date1 = _t, #"Date 2" = _t, #"Date 3" = _t, Description = _t]),
    #"Changed Type with Locale" = Table.TransformColumnTypes(Source, {{"Date1", type date}, {"Date 2", type date}, {"Date 3", type date}}, "en-US"),
    #"Grouped Rows" = Table.Group(#"Changed Type with Locale", {"Id"}, {{"Date1", each List.Max([Date1]), type nullable date}, {"Date2", each List.Max([Date 2]), type nullable date}, {"Date3", each List.Max([Date 3]), type nullable date}, {"Descripition", each List.Max([Description]), type nullable text}})
in
    #"Grouped Rows"

Best Regards,
Community Support Team_ Yalan Wu
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
v-yalanwu-msft
Community Support
Community Support

Hi, @mglomb ;

You could group by in power query .

vyalanwumsft_0-1635148658703.png

The final output is shown below:

vyalanwumsft_1-1635148682559.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQ0VNJRMjTQNzLUNzIwAnEgyCkxL1EhL1EpVgemCKIOpMzAEKEGXQkQWepbwMxCUmFkbAKWA9kFkQSykS31L0rMS09FUgtBFvrGMEVIKkxMzaDuNkB1d0BqYnIGmhJDrEpiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Id = _t, Date1 = _t, #"Date 2" = _t, #"Date 3" = _t, Description = _t]),
    #"Changed Type with Locale" = Table.TransformColumnTypes(Source, {{"Date1", type date}, {"Date 2", type date}, {"Date 3", type date}}, "en-US"),
    #"Grouped Rows" = Table.Group(#"Changed Type with Locale", {"Id"}, {{"Date1", each List.Max([Date1]), type nullable date}, {"Date2", each List.Max([Date 2]), type nullable date}, {"Date3", each List.Max([Date 3]), type nullable date}, {"Descripition", each List.Max([Description]), type nullable text}})
in
    #"Grouped Rows"

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@mglomb ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.

 

You can check for fill up and filldown and pivot and unpivot options in power query

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for trying to help. I've drawn a simple example of what the database look and what I'm trying to achieve. Please see below:

 

Screenshot 2021-10-21 095435.jpg

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.