Forum Discussion
ThiemenSiemensm
3 years agoFrequent Visitor
Create list from range and values
Hi everyone, I need an extra column in power query (list) from which I can generate a set of rows in power query for each of the items in the list. The contents of the list must be based values ...
- 3 years ago
Here's one way to do it in the query editor. To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtTTM60xNNDTMzStMQJSxgZKsTpAYQOQkBFIDMgwMoSIGoPoWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ListsAsText = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"ListsAsText", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Combine(List.Transform(Text.Split([ListsAsText], "|"), each Expression.Evaluate("{"&_&"}")))), #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom") in #"Expanded Custom"Pat
ppm1
3 years agoSolution Sage
Here's one way to do it in the query editor. To see how it works, just create a blank query, open the Advanced Editor and replace the text there with the M code below.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtTTM60xNNDTMzStMQJSxgZKsTpAYQOQkBFIDMgwMoSIGoPoWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ListsAsText = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ListsAsText", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Combine(List.Transform(Text.Split([ListsAsText], "|"), each Expression.Evaluate("{"&_&"}")))),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom")
in
#"Expanded Custom"
Pat
ThiemenSiemensm
3 years agoFrequent Visitor
Thanks, this worked!