Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi,
I have the following looping API call in PowerBI desktop, is there anything I can add/change so that it loops for say only the first 1000 records (10 pages) instead of returning all records?
let
ufnQuery = (n) =>
let
jsonDoc= Json.Document(
Web.Contents(
"[replace this with web address]/?&start=" & Number.ToText(n))),
result = jsonDoc[result],
records = result[records],
tmpTbl = Table.FromList(records, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
tmpTbl,
fnRecursive = (tbl, n) =>
if Table.RowCount(ufnQuery(n)) > 0 then @fnRecursive(Table.Combine({tbl, ufnQuery(n)}), n+100) else tbl,
tbl = ufnQuery(0),
final = fnRecursive(tbl ,100),
#"Expanded Column1" = Table.ExpandRecordColumn(final, "Column1", {"id", "start", "answer", "end", "src", "dst", "from_number", "to_number", "from_name", "to_name", "billsec", "disposition", "lastapp", "userfield", "faxdata", "lastdata", "cost", "organization", "channel", "dstchannel", "app", "callclass", "dest_type", "duration", "dcontext", "pbxid", "type", "timezone"}, {"id", "start", "answer", "end", "src", "dst", "from_number", "to_number", "from_name", "to_name", "billsec", "disposition", "lastapp", "userfield", "faxdata", "lastdata", "cost", "organization", "channel", "dstchannel", "app", "callclass", "dest_type", "duration", "dcontext", "pbxid", "type", "timezone"})
in
#"Expanded Column1"
@jdchipps , refer if this can help
https://datachant.com/2016/06/27/cursor-based-pagination-power-query/
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 68 | |
| 61 | |
| 45 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 108 | |
| 107 | |
| 39 | |
| 30 | |
| 26 |