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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Using Cursor Paginiation - Help required

I have an API data source that returns 1 record and it uses cursor pagination. But I am new to Power BI and can't figure out how to do a response call to look up the next record and so on if more. 

 

Can someone assist, have tried multiple options but none seem to work

 

screenshot.png

 

 

 

1 REPLY 1
Anonymous
Not applicable

HI @Anonymous ,

I think query paginated should suitable for your requirements. You can check at the following document or write a custom function with an iterator to merge each result and invoke web API with next cursor key:

Power query Handling Paging 

Sample:

let 
	GetListByCurrsor=(rootpath as text,apikey as text, size as number,optional _currsor as text, optional resultList as list) as list=>
	let
		Source=if 
                    _currsor<>null 
                then 
                    Json.Document(Web.Contents(rootpath&"&"&_currsor,[Header=[#"XXX-Api-Key"=apikey]])) 
                else 
                    Json.Document(Web.Contents(rootpath,[Header=[#"XXX-Api-Key"=apikey]])),
		Result=if 
                    resultList<> null 
               then 
                    if 
                        List.Count(resultList)<size 
                    then 
                        @GetListByCurrsor(rootpath,apikey,size,Source[currsor], List.Combine({resultList,Source[events]})) 
                    else
                        resultList
                else
                    @GetListByCurrsor(rootpath,apikey,size,Source[currsor],Source[events])
	in
		Result
in
	GetListByCurrsor

Comment: rootpath is API URL, apikey is the header optional parameter, size is the max size of the result, _cursor is cursor key, resultList is the list store and merge result.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.