Forum Discussion
AlessandroBet
Helper V
4 years agoMerge rows of table
Hi, i have a table with 2 columns Column A: list of many email with some duplicate Column B: with some text I need to group all the identical email of column A in 1 row merging all the text...
Anonymous
4 years agoNot applicable
Hi AlessandroBet ,
You could duplicate the original table and only keep the necessary column , the paste the following M in Advanced Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wqqio0ANih/TcxMwcveT8XCUdpZDUihJdR6VYHXzS1mDKCb8qZ7B0ZWWlHhBjlY4FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", type text}}),
#"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"B", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "B"),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"B", type text}}),
#"Removed Duplicates" = Table.Distinct(#"Changed Type1"),
#"Grouped Rows" = Table.Group(#"Removed Duplicates", {"A"}, {{"Count", each Text.Combine([B],";"),type text}})
in
#"Grouped Rows"
Output:
Then could merge the two tables to relate the combined column to the original table.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AlessandroBet
Helper V
4 years agoHi now it works.
The problem was because i have "; " and in your text ";".
But the test done is only with 2 columns and i have to add others.
Can you help me?