Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
LasseL
Helper I
Helper I

Advanced query code: pick top key name to table

Dear all,

 

I am performing the ETL on document-sources and I have struggle transforming one column, namely "Production".

Udklip1.PNG

Udklip2.PNG

 

When I click expand, as you can see, I get my required value (guid) as a key and I am unable to find the method to transform the "Record" to the guid. I am looking into something along Table.Keys and Top 1, but I can't figure out how to code it in M.

 

Current query script is as follows:

let
    Source = Json.Document(Binary.Decompress(Web.Contents("https://" & Environment & "/v0a/" & "" & Workspace & "" & "/Integration/BusinessIntelligence/GetByFiletype/" & "Entity" & "?Compressed=true"), Compression.GZip)),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "WorkflowId", "Locations", "ItemId", "ProjectReferenceId", "OrderReferenceId", "Status", "LogisticStatus", "Identifiers", "Quantity", "Dates", "Metrics", "QuickStatus"}, {"id", "WorkflowId", "Locations", "ItemId", "ProjectId", "OrderId", "Status", "LogisticStatus", "Identifiers", "Quantity", "Dates", "Metrics", "QuickStatus"}),
    #"Expanded Locations" = Table.ExpandRecordColumn(#"Expanded Column1", "Locations", {"Production"})
in
    #"Expanded Locations"

 

Any ideas?

 

Desired outcome is:

Udklip3.PNG

 

 

It might help by understanding the JSON source structure, here's a snap from one of the documents:

 

"Locations": {
"CurrentLocation": {
"ID": "93468a60-35e2-4d34-932d-ffca6308892a",
"Custom": null
},
"All": {
"93468a60-35e2-4d34-932d-ffca6308892a": {
"ID": "93468a60-35e2-4d34-932d-ffca6308892a",
"Custom": null
}
},
"Production": {
"93468a60-35e2-4d34-932d-ffca6308892a": {
"ID": "93468a60-35e2-4d34-932d-ffca6308892a",
"Custom": null
}
},
"Storage": {
"93468a60-35e2-4d34-932d-ffca6308892a": {
"ID": "93468a60-35e2-4d34-932d-ffca6308892a",
"Custom": null
}
},
"Shipping": {},
"Delivery": {}
}
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi, @LasseL

Here is the document for you to check if it could help you.

https://powerbi.microsoft.com/en-us/blog/how-to-expand-a-list-of-records-in-a-query/

https://community.powerbi.com/t5/Desktop/Expanding-records-from-JSON/td-p/340256

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi, @LasseL

Here is the document for you to check if it could help you.

https://powerbi.microsoft.com/en-us/blog/how-to-expand-a-list-of-records-in-a-query/

https://community.powerbi.com/t5/Desktop/Expanding-records-from-JSON/td-p/340256

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.