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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Shure846
Helper III
Helper III

API data expansion help

Hi - I'm attempting to expand the data from a USDA report; https://mpr.datamart.ams.usda.gov/services/v1.1/reports/2498

 

I can get it into PowerQuery editor easily, but I cannot figure out how to expand the whole thing into the row level data. I get here: 

 

Shure846_0-1698769707731.png

 

Then convert it to a table, but then I'm stuck. Any next step gives me a list of values, rather than the dataset that I'm looking for. 

Shure846_1-1698769766230.png

 

I would really appreciate any help. 

 

Thanks in advance~ 

 

2 REPLIES 2
ppm1
Solution Sage
Solution 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 = Json.Document(Web.Contents("https://mpr.datamart.ams.usda.gov/services/v1.1/reports/2498")),
    #"Converted to Table" = Table.FromRecords({Source}),
    #"Expanded stats" = Table.ExpandRecordColumn(#"Converted to Table", "stats", {"totalRows:", "returnedRows:", "userAllowedRows:"}, {"stats.totalRows:", "stats.returnedRows:", "stats.userAllowedRows:"}),
    #"Expanded results" = Table.ExpandListColumn(#"Expanded stats", "results"),
    #"Expanded results1" = Table.ExpandRecordColumn(#"Expanded results", "results", {"report_date", "is_correction", "narrative", "report_title", "slug_name", "slug_id", "office_name", "office_code", "office_city", "office_state", "market_location_name", "market_location_city", "market_location_state", "market_type", "market_type_category", "published_date"}, {"report_date", "is_correction", "narrative", "report_title", "slug_name", "slug_id", "office_name", "office_code", "office_city", "office_state", "market_location_name", "market_location_city", "market_location_state", "market_type", "market_type_category", "published_date"})
in
    #"Expanded results1"

 

Pat

Microsoft Employee

Thanks - but it still doesn't appear that the query is fully expanded: 

Shure846_0-1698875449935.png

 

Thanks for the help! 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.