Forum Discussion
Help with expanding json list columns
- 5 years ago
Hi all,
Thanks for your effort and replies. I found a solution to my issue from here :
https://community.powerbi.com/t5/Power-Query/Multi-Dimensional-Json-file-to-Table/td-p/113667
In the end I combined the extracted columns into one.
Hello jereaallikko
I don't know exactly how this list is structured, but I suppose it contains records with 2 fields. one called "id", the other one "label". If it's like this, this transformation should work out. Check out this code
let
YourTable = #table(type table[ID= text, Column1= list ], {{"ID12345", {[id= 1234, label= "testlabel"], [id= 1237, label= "testlabel7"]}},{"ID12346", {[id= 1235, label= "testlabel1235"]}}}),
TransformListOfRecordsToText = Table.TransformColumns
(
YourTable,
{
{
"Column1",
(listint)=>Text.Combine(List.Transform(listint, each Record.Field(_,"label")), "#(lf)")
}
}
)
in
TransformListOfRecordsToText
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