Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
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/
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 62 | |
| 58 | |
| 45 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 121 | |
| 116 | |
| 37 | |
| 34 | |
| 30 |