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
PatrickArrastia
Regular Visitor

Power Query and pagination

Hello,

I am trying to paginate through an unknown number of pages. There is a value in the table called "end_of_stream", which I think could be used for this. Once there are no more pages the "end_of_stream" value = true.
I believe there is a way to use List.Generate to achieve this just unsure of how to get there.

 

In this run the only code I have so far is below, screenshot highlighting the table with the "end_of_stream" value below that.

 

let
Source = Json.Document(Web.Contents("insert subdomain.zendesk.com here")
#"Converted to Table" = Record.ToTable(Source)
in
#"Converted to Table"

 

end_of_stream.png

Ideally, PQ will loop through the pages until it sees the "end_of_stream" value = true.

This particular api uses cursor-based pagination as opposed to offset with a max of 100 per page

 

Many thanks!

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @PatrickArrastia 

 

Your problem is very similar to this one

 

Solved: Need Help with Stripe REST API Pagination in Power... - Microsoft Power BI Community

 

You can try this code which of course needs a little modification to include your URL

let
    APICall = 

        List.Generate
        (  
            () => [ APIData = Json.Document(Web.Contents("insert subdomain.zendesk.com here")) , EndData = APIData[end_of_stream] ],

            each [EndData] = "FALSE",
           
            each [ APIData = Json.Document(Web.Contents("insert subdomain.zendesk.com here")) , EndData = [APIData][end_of_stream] ],

            each [APIData]
        )
in
    APICall

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
PhilipTreacy
Super User
Super User

Hi @PatrickArrastia 

 

Your problem is very similar to this one

 

Solved: Need Help with Stripe REST API Pagination in Power... - Microsoft Power BI Community

 

You can try this code which of course needs a little modification to include your URL

let
    APICall = 

        List.Generate
        (  
            () => [ APIData = Json.Document(Web.Contents("insert subdomain.zendesk.com here")) , EndData = APIData[end_of_stream] ],

            each [EndData] = "FALSE",
           
            each [ APIData = Json.Document(Web.Contents("insert subdomain.zendesk.com here")) , EndData = [APIData][end_of_stream] ],

            each [APIData]
        )
in
    APICall

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


v-yalanwu-msft
Community Support
Community Support

Hi, @PatrickArrastia ;

If you use pagination, consider using Power BI Report Builder;

Power BI Report Builder - Power BI | Microsoft Learn
According to my understanding, you mean that when "end_of_stream" value = true, the later data will not be displayed, only the previous data will be displayed, right?


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

 

Hello!

 

Thank you for your reply, your understanding is correct. Is there a way to achieve this by only using Power Query in Excel? 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors