Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am making API call in Power BI:
Source = Json.Document(Web.Contents( APIURL & "/commonapi/search?name=myName&eCode=FCD&recordStart=1&recordLimit=1")),
Total = Source[results-total]
The response JSON is:
I want to get the results-total which is 152 in variable "Total". But I am getting error in line:
Total = Source[results-total]
As "results-total" is inside the "responseHeader" in JSON. What can be the correct code line for Total = Source[results-total]?
Thanks in advance for any help
Solved! Go to Solution.
It may be Source[responseHeader][response-total], unless either of those are arrays, but why not just use the Power BI interface to drill into the JSON, which will create the needed Navigation step?
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks for the quick solution.
I have to make multiple calls to API with recordStart and recordLimit parameters. API is returning 1000 records only, so pagination is required and hence for looping purpose I need to know total records returned so I can loop the API calls accordingly.
Please see if this video helps you out with pagination including the total count.
Power BI - Tales From The Front - REST APIs - YouTube
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
It may be Source[responseHeader][response-total], unless either of those are arrays, but why not just use the Power BI interface to drill into the JSON, which will create the needed Navigation step?
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
48 | |
19 | |
13 | |
11 |