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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dogburalHK82
Helper III
Helper III

combine rows if values in other columns are the same

Hi, 

Can you please advise how i can combine rows in the same column if values in the columns (1 & 2) are the same?

 

dogburalHK82_1-1702592596487.png

 

 

1 ACCEPTED SOLUTION
spinfuzer
Solution Sage
Solution Sage

Group By Column1 and Column2 with operation all rows and name it something like "All".

 

You'll get a formula such as:

= Table.Group(#"Changed Type", {"Column1", "Column2"}, {{"All", each _, type table [Column1=nullable text, Column2=nullable text, Column3=nullable number, Column4=nullable number]}})

 

change the each _ to each Table.FirstN(Table.FillUp(_,Table.ColumnNames(_)),1) to end up with the below

= Table.Group(#"Changed Type", {"Column1", "Column2"}, {{"All", each Table.FirstN(Table.FillUp(_,Table.ColumnNames(_)),1), type table [Column1=nullable text, Column2=nullable text, Column3=nullable number, Column4=nullable number]}})

 

Just remove all columns except for the table column and expect.

View solution in original post

6 REPLIES 6
dogburalHK82
Helper III
Helper III

@spinfuzer 

It turns out to be like below; what did I do wrong here?

dogburalHK82_0-1702594606498.png

 

dogburalHK82_1-1702594619450.png

 

Group By the Columns that are common, Column1 and Column2.  You are grouping by Column3 and Column4.

 

 

 

@spinfuzer Thanks, I could do that with the simple sample.

 

However, when i tried with more columns, I could not get it correct.

Below is a raw data 

dogburalHK82_0-1702599484357.png

I did query and grouping; but turned out incorrectly.

dogburalHK82_1-1702599561839.png

 

dogburalHK82_2-1702599581259.png

 

Column10 and Column11 are not null.

You can select them and then do a replace values blank with null then perform the group by fill up.

@spinfuzer Thank you very much

spinfuzer
Solution Sage
Solution Sage

Group By Column1 and Column2 with operation all rows and name it something like "All".

 

You'll get a formula such as:

= Table.Group(#"Changed Type", {"Column1", "Column2"}, {{"All", each _, type table [Column1=nullable text, Column2=nullable text, Column3=nullable number, Column4=nullable number]}})

 

change the each _ to each Table.FirstN(Table.FillUp(_,Table.ColumnNames(_)),1) to end up with the below

= Table.Group(#"Changed Type", {"Column1", "Column2"}, {{"All", each Table.FirstN(Table.FillUp(_,Table.ColumnNames(_)),1), type table [Column1=nullable text, Column2=nullable text, Column3=nullable number, Column4=nullable number]}})

 

Just remove all columns except for the table column and expect.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors