Forum Discussion
Pivoting a column and merging linked fields
- 6 years ago
Hi Merleau ,
you can pivot on the Type-column and use a Text.Combine-function as the aggregation function on the "Programs"-column.
Create a new query and paste this code into the advanced editor:let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8nQxVNJRcvQFEq556TmZxRlgNlBYNy8xN1UpVgemJgAkHlyQmAdUE4BDDURvSWJOZmIeLnPA4m5FqXnJWK0ywqrECF0J2AXO+UWpiXkBOJRg8RSKGmOYMY5FiUmZyVBjjLEqgfoJmxqIn3QDckqLgSz3otTUbAQX4blYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Type = _t, Programs = _t, Name = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", type text}, {"Type", type text}, {"Programs", type text}, {"Name", type text}}), #"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[Type]), "Type", "Programs", each Text.Combine(_, ", ")) in #"Pivoted Column"Enclosing a file a well.
- Anonymous6 years ago
I'm not sure I understand this request correctly.
I guess this modification of this expression:
Table.AddColumn(#"Grouped Rows", "Custom", each [Count][Programs])
to
Table.AddColumn(#"Grouped Rows", "Custom", each List.Sort([Count][Programs]))
I'm not sure I understand this request correctly.
I guess this modification of this expression:
Table.AddColumn(#"Grouped Rows", "Custom", each [Count][Programs])
to
Table.AddColumn(#"Grouped Rows", "Custom", each List.Sort([Count][Programs]))
Thank you so much for all your solution and contribution.
I will accept Anonymous's last suggestion as a response because it works.
However, I am still looking for a solution in DAX.
Thank you