Forum Discussion
Anonymous
2 years agoNot applicable
Combine text from multiple rows in the same column and filter duplicates
Hi all, I've been trying to find an answer to my problem but alas I haven't found a Power Query (M) answer to this. I would like to combine the names in a column based off the ID and filter a...
- 2 years ago
hi Anonymous ,
create a blank query and copy paste the code below into the advanced editor.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8nRR0lHyS8xNVYrViVYyBHKc8pMUgnMzSzLwiHgl5qUquORDNBmBlGTm5CCpAQl55acqeOVn5BXn52EXiwUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t]), #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"ID", Int64.Type}, {"Name", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"Data", each _, type table [ID=nullable number, Name=nullable text]}, {"Name List", each Text.Combine(List.Distinct([Name]), ", "), type nullable number}}), #"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Name"}, {"Name"}) in #"Expanded Data"
adudani
Memorable Member
2 years agoIf there are no errors until the grouped rows steps, then.
In the expand all data step, select the columns you want to expand.
Let me know if this works for you
Anonymous
2 years agoNot applicable
Thank you! I got it working!