Forum Discussion
How to Parse and Extrat data from column using delimiter
- 5 years ago
Hello Cami
check out this solution. It's dynamically
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("LYy9CoAgGEXf5ZsdUqvdKQgChzavg4RU4B9G759Iyx3OOVxjiBOjPce2gColeGAEtHcVmMgyQ6I5Fe7D90aHNwJ86Eo2tOYrdbNUV/wDCGBz6czA/F82KMnaDw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Name = _t, FruitsQuantity = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Name", type text}, {"FruitsQuantity", type text}}), TransformTextWIthSplitterToTable = Table.TransformColumns ( #"Changed Type", { { "FruitsQuantity", each Table.FromRecords(List.Transform(List.Split(Text.SplitAny(Text.End(_,Text.Length(_)-1),"\"),2), each [Fruit= _{0}, Quantity= _{1}])) } } ), Expand = Table.ExpandTableColumn(TransformTextWIthSplitterToTable, "FruitsQuantity", {"Fruit", "Quantity"}, {"Fruit", "Quantity"}) in ExpandCopy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello Cami
check out this solution. It's dynamically
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("LYy9CoAgGEXf5ZsdUqvdKQgChzavg4RU4B9G759Iyx3OOVxjiBOjPce2gColeGAEtHcVmMgyQ6I5Fe7D90aHNwJ86Eo2tOYrdbNUV/wDCGBz6czA/F82KMnaDw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Name = _t, FruitsQuantity = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Name", type text}, {"FruitsQuantity", type text}}),
TransformTextWIthSplitterToTable = Table.TransformColumns
(
#"Changed Type",
{
{
"FruitsQuantity",
each Table.FromRecords(List.Transform(List.Split(Text.SplitAny(Text.End(_,Text.Length(_)-1),"\"),2), each [Fruit= _{0}, Quantity= _{1}]))
}
}
),
Expand = Table.ExpandTableColumn(TransformTextWIthSplitterToTable, "FruitsQuantity", {"Fruit", "Quantity"}, {"Fruit", "Quantity"})
in
Expand
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
This very much solves my problem.
Great approach, thanks a lot!