Forum Discussion
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?
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.
6 Replies
- spinfuzer
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.
- dogburalHK82
Helper III
- spinfuzer
Solution Sage
Group By the Columns that are common, Column1 and Column2. You are grouping by Column3 and Column4.
- dogburalHK82
Helper III
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
I did query and grouping; but turned out incorrectly.