Forum Discussion
GraceJinM
1 year agoFrequent Visitor
Merging multiple rows into one but only keeping select responses.
Hi, I posted another thread about this topic and got lots of solutions that all worked, but the reality of what we need our data to look like keeps changing based on the client's feedback. I've ...
- 1 year ago
Hi GraceJinM,
Bit confused here, based on your example you are taking the max value from each column, not "selecting a row" based on a max value. Well, give this a go.
let Source = Table.FromRows( { {"A", 1, 2, #date(2024, 9, 3)}, {"A", null, 4, #date(2024, 9, 4)}, {"B", 4, #date(2024, 9, 2), #date(2024, 9, 3)}, {"B", 3, null, #date(2024, 9, 5)} }, {"Section N", "Column1", "Column2", "Column3"} ), GroupRows = Table.Group(Source, {"Section N"}, {{"t", each [Column1=List.Max([Column1]), Column2=List.Max([Column2]), Column3=List.Max([Column3])]}} ), Expand = Table.ExpandRecordColumn(GroupRows, "t", {"Column1", "Column2", "Column3"}) in ExpandI hope this is helpful
m_dekorte
1 year agoResident Rockstar
Hi GraceJinM,
Bit confused here, based on your example you are taking the max value from each column, not "selecting a row" based on a max value. Well, give this a go.
let
Source = Table.FromRows(
{
{"A", 1, 2, #date(2024, 9, 3)},
{"A", null, 4, #date(2024, 9, 4)},
{"B", 4, #date(2024, 9, 2), #date(2024, 9, 3)},
{"B", 3, null, #date(2024, 9, 5)}
},
{"Section N", "Column1", "Column2", "Column3"}
),
GroupRows = Table.Group(Source, {"Section N"},
{{"t", each [Column1=List.Max([Column1]), Column2=List.Max([Column2]), Column3=List.Max([Column3])]}}
),
Expand = Table.ExpandRecordColumn(GroupRows, "t", {"Column1", "Column2", "Column3"})
in
Expand
I hope this is helpful