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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
SimonKragh
Frequent Visitor

Stuck with "nested" records

Hi,

 

I have been trying to develop an interactive dashboard to visualise performance for overwatch players, however i have gone stuck.

Firstly i created a hero dimension with the basical stats in form of playtime etc using the following api call:

 

Json.Document(Web.Contents("https://api.lootbox.eu/pc/eu/donatellow-2669/competitive-play/heroes"))

 

Afterwards i wanted to get performance by each individual hero by using the following API call (as illustrated in this article: http://datachix.com/2014/05/22/power-query-functions-some-scenarios/😞

 

Json.Document(Web.Contents("https://api.lootbox.eu/pc/eu/"& accountName &"/competitive-play/hero/"& charString & "/"))

 

Where accountName and charString is identifier for the account and which character. However, this returns the following result: 

recordsError.png

I have tried using the expand button which leads to the following result, which is not what i want:

expandError.png

Each record contains the following columns which i want to store directly in my table:

stats.png

Any suggestions to how i achieve this? 

1 ACCEPTED SOLUTION

@SimonKragh


 

The appove code gives me the record which contains a record. Do you have any suggestiosn how i can access the nested record directly from the above query?


Please try the formula below.

let getOWHeroesStats = (charString as text) =>
let Source = Json.Document(Web.Contents("https://api.lootbox.eu/pc/eu/donatellow-2669/competitive-play/hero/"& charString & "/")),
Hero = Record.FieldOrDefault(Source, charString),
#"Converted to Table" = Record.ToTable(Hero),
#"Transposed Table" = Table.Transpose(#"Converted to Table"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table")

in #"Promoted Headers"
in getOWHeroesStats

Following is the result for hero "Tracer".

Tracer.PNG

 

Regards

View solution in original post

6 REPLIES 6
ankitpatira
Community Champion
Community Champion

@SimonKragh I think it will work if you do it as two seperate data queries. So have another query with all your Json records. Then pivot it so columns (Roadhog, Lucio, Tracer) becomes rows in a new column (call it Character Name). Then Merge both queries using Character name column. Hope that make sense. 

@ankitpatira I tried your suggesting but it leads me to the same result within its own Query this time as seen below. 

query2.png

Which is quiet the same except i dont have the first columns with playtme etc.

 

Any other suggestions? 

 

Regards.

@SimonKragh Can you try Append instead of Merging. I think append will do the trick.

Hi.

 

Nope, didn't do the trick either 😕 

Isn't there someway in my functions that i can get the nested record directly to the column? 

let getOWHeroesStats = (charString as text) =>
  let Source = Json.Document(Web.Contents("https://api.lootbox.eu/pc/eu/donatellow-2669/competitive-play/hero/"& charString & "/"))
in Source
    in getOWHeroesStats

The appove code gives me the record which contains a record. Do you have any suggestiosn how i can access the nested record directly from the above query?

 

Best,

Simon

 

@SimonKragh


 

The appove code gives me the record which contains a record. Do you have any suggestiosn how i can access the nested record directly from the above query?


Please try the formula below.

let getOWHeroesStats = (charString as text) =>
let Source = Json.Document(Web.Contents("https://api.lootbox.eu/pc/eu/donatellow-2669/competitive-play/hero/"& charString & "/")),
Hero = Record.FieldOrDefault(Source, charString),
#"Converted to Table" = Record.ToTable(Hero),
#"Transposed Table" = Table.Transpose(#"Converted to Table"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table")

in #"Promoted Headers"
in getOWHeroesStats

Following is the result for hero "Tracer".

Tracer.PNG

 

Regards

@v-ljerr-msft Yes yes yes! Works like a charm! Thank you so much! 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.