Forum Discussion
RobHess05
5 years agoHelper I
Need help paging in my Power Query
I'm looking to implement paging in my Power Query. I'm currently querying a REST API, and have successfully built code to authenticate, query & transform the data. The API only returns a portion of...
- 5 years ago
Please see this video for one way to accomplish this.
Power BI - Tales From The Front - REST APIs - YouTube
Pat
mahoneypat
5 years agoMicrosoft Employee
Please see this video for one way to accomplish this.
Power BI - Tales From The Front - REST APIs - YouTube
Pat
- RobHess055 years agoHelper I
Love this solution. The each statement that allows me to loop thru multiple API calls is key.
Here's my code in case someone stumbles across this. I had to screen capture it from the video, and adjust to make my own 🙂BTG_ManageImplPage = (url as text) => let source = Json.Document(Web.Contents(url & "/count", [ Headers = DefaultRequestHeaders ])), count = (source[count]), pages = List.Numbers(0,count/PageSize, PageSize), #"Converted to Table" = Table.FromList(pages, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type text}}), #"Added Custom" = Table.AddColumn( #"Changed Type", "Custom", each Json.Document(Web.Contents(url & "?pageSize=" & Number.ToText(PageSize) & "&page="&[Column1], [ Headers = DefaultRequestHeaders ]))), #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"), in #"Expanded Custom";