Forum Discussion
John1234
5 years agoFrequent Visitor
Summarize by different column when blank
Hi, I'm trying to create household level data for our users by using 'summarize' to group users with the same address. For example, if user A ([email protected]), and user B ([email protected]), live...
- 5 years ago
Hi John1234
you can take steps below for reference.
1. Open the Advanced editor:
2. Empty the contents in the Advanced editor, and copy the following code into it
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxJKUotLjZU0lFKzU3MzDFUitXBFDUCi8J4xig8E2QdpjBRU6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Address = _t, Email = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Address", type text}, {"Email", type text}}), #"Filtered Rows" = Table.SelectRows(Source, each ([Address] <> "")), #"Grouped Rows" = Table.Group(#"Filtered Rows", {"Address"}, {{"Email", each Text.Combine([Email],", "), type text}}), table1= Table.SelectRows(Source, each ([Address] = "")), #"appendtable"=Table.Combine({table1, #"Grouped Rows"}) in #"appendtable"Result:
Hope this helps.
Best Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
v-xiaotang
5 years agoCommunity Support
Hi John1234
you can take steps below for reference.
1. Open the Advanced editor:
2. Empty the contents in the Advanced editor, and copy the following code into it
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxJKUotLjZU0lFKzU3MzDFUitXBFDUCi8J4xig8E2QdpjBRU6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Address = _t, Email = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Address", type text}, {"Email", type text}}),
#"Filtered Rows" = Table.SelectRows(Source, each ([Address] <> "")),
#"Grouped Rows" = Table.Group(#"Filtered Rows", {"Address"}, {{"Email", each Text.Combine([Email],", "), type text}}),
table1= Table.SelectRows(Source, each ([Address] = "")),
#"appendtable"=Table.Combine({table1, #"Grouped Rows"})
in
#"appendtable"
Result:
Hope this helps.
Best Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
- John12345 years agoFrequent Visitor
Thank you!