Forum Discussion

shubhj123's avatar
shubhj123
New Member
1 year ago

Required Pagination support from Power BI

Currently We want to implement pagination on power bi  desktop anaplan connector models views by limit 5k at a time.

 

The api who fetch all models https://api.anaplan.com/2/0/models.

 

This endpoint also supports pagination. Following is the format
/2/0/models?offset=0&limit=5000 and 2/0/models?offset=5000&limit=5000

 

just wanted to know from power bi desktop there is any entry point to switching from one page to another page as we implementing pagination.  In power bi desktop design is there "next button" design support is there from UI side

 

PowerBI shubhj123 

 

1 Reply

  • Hi shubhj123 

    I don't know if there is a Next button but you can create a function, this lets you effectively loop the api.

    Set up the connection once.

    Create a parameter (or two) for the start number which presumably here is the offset.

    Set that to 5000 when you create it.

    Modify the M row of source so it is something like:
    "/2/0/models?offset=0&limit=5000 and 2/0/models?offset=" & parStart & "&limit=5000"

    This lets the offset be equal to the parameter, check that works.

     

    Now right click the query and choose create function

    Give it a name like fnLoopPages

     

    Using Enter Data or by importing an excel sheet create a list of the number of rows to loop.

    5000, 10000, 15000, 20000 etc

    On the Add Column tab choose Invoke custom function

    This will ask you which function to use, then a list will appear asking you to populate the parameters

    Choose your column containing the Number column (repeat for any other parameters you created)

     

    You should now see a new column with an expand option.

    This shows you which columns the api will return, untick the ones you dont want.

    Let the query run and it will append all the rows

    Delete the initial number column

     

    Enjoy!