Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi ,
Wonder if I can get any help on expanding this json result in response to a Post API the response is Json.
There are only 5 rows worth data here and on 3 List columns as per below. 1st and 3rd column has row values and 2nd column is cominbation of 7 field record.
Appreciate your help.
Basically I want a row each with list value for 1st column, expanded record fields of 2nd column and value of 3rd column.
Thank you.
Solved! Go to Solution.
Thanks Zoe, I tried expanding the columns 2 list columns will expand to 5 records each with repeats and record field in the middle can't be extended.
Basically what I want to do is to parse this JSON to a data table below.
Hi @Anonymous
Please see the attached file with a solution or the below script, the main transformation takes place in Added Custom step.
let
Source = Json.Document(File.Contents("C:\Users\mariu\OneDrive\Desktop\test.json")),
#"Converted to Table" = Record.ToTable(Source),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Value] <> null and [Value] <> "")),
#"Transposed Table" = Table.Transpose(#"Filtered Rows"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Added Custom" = Table.AddColumn(#"Promoted Headers", "Custom", (a) => let
countRows = List.Max (
{
List.Count( a[MeasDataTypes] ),
List.Count( a[MeasDateTimes] ),
List.Count( a[MeasValues] )
}
) -1,
iList = { 0..countRows },
transform = List.Transform(
iList,
(b) => [
MeasDataTypes = a[MeasDataTypes]{b}?,
MeasDateTimes = a[MeasDateTimes]{b}?,
MeasValues = a[MeasValues]{b}?
]
)
in transform),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
#"Expanded Custom" = Table.ExpandListColumn(#"Removed Other Columns", "Custom"),
#"Expanded Custom1" = Table.ExpandRecordColumn(#"Expanded Custom", "Custom", {"MeasDataTypes", "MeasDateTimes", "MeasValues"}, {"MeasDataTypes", "MeasDateTimes", "MeasValues"}),
#"Expanded MeasDateTimes" = Table.ExpandRecordColumn(#"Expanded Custom1", "MeasDateTimes", {"Day", "HasBeenSet", "Hour", "Minute", "Month", "Second", "Year"}, {"MeasDateTimes.Day", "MeasDateTimes.HasBeenSet", "MeasDateTimes.Hour", "MeasDateTimes.Minute", "MeasDateTimes.Month", "MeasDateTimes.Second", "MeasDateTimes.Year"})
in
#"Expanded MeasDateTimes"
Let me know if you need any help.
Hi @Anonymous ,
I am not clear about your requirement, you could try to expand these columns to see whether it work or not
By the way, you also could inform me your expected output or your sample data.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks Zoe, I tried expanding the columns 2 list columns will expand to 5 records each with repeats and record field in the middle can't be extended.
Basically what I want to do is to parse this JSON to a data table below.
Hi @Anonymous
Please see the attached file with a solution or the below script, the main transformation takes place in Added Custom step.
let
Source = Json.Document(File.Contents("C:\Users\mariu\OneDrive\Desktop\test.json")),
#"Converted to Table" = Record.ToTable(Source),
#"Filtered Rows" = Table.SelectRows(#"Converted to Table", each ([Value] <> null and [Value] <> "")),
#"Transposed Table" = Table.Transpose(#"Filtered Rows"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Added Custom" = Table.AddColumn(#"Promoted Headers", "Custom", (a) => let
countRows = List.Max (
{
List.Count( a[MeasDataTypes] ),
List.Count( a[MeasDateTimes] ),
List.Count( a[MeasValues] )
}
) -1,
iList = { 0..countRows },
transform = List.Transform(
iList,
(b) => [
MeasDataTypes = a[MeasDataTypes]{b}?,
MeasDateTimes = a[MeasDateTimes]{b}?,
MeasValues = a[MeasValues]{b}?
]
)
in transform),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
#"Expanded Custom" = Table.ExpandListColumn(#"Removed Other Columns", "Custom"),
#"Expanded Custom1" = Table.ExpandRecordColumn(#"Expanded Custom", "Custom", {"MeasDataTypes", "MeasDateTimes", "MeasValues"}, {"MeasDataTypes", "MeasDateTimes", "MeasValues"}),
#"Expanded MeasDateTimes" = Table.ExpandRecordColumn(#"Expanded Custom1", "MeasDateTimes", {"Day", "HasBeenSet", "Hour", "Minute", "Month", "Second", "Year"}, {"MeasDateTimes.Day", "MeasDateTimes.HasBeenSet", "MeasDateTimes.Hour", "MeasDateTimes.Minute", "MeasDateTimes.Month", "MeasDateTimes.Second", "MeasDateTimes.Year"})
in
#"Expanded MeasDateTimes"
Let me know if you need any help.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.