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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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