Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Happy Wednesday. I have the following code which calls a function that gets API results. All works just fine as long as there's more than one loop needed (so > 500 records). I'd love to know what I'm doing wrong (and how I might write this better). I've used this for several different APIs with success - this is the only one that is giving me issues.
let
Source = (wfReportId as text, optional aftCursor as text) => let Source =
List.Generate(() =>
[
Result = try fnGetComplianceFW(wfReportId, aftCursor) otherwise null
, afterCursor = Result[data][policyAssessments][pageInfo][endCursor]
]
, each [Result][data][policyAssessments][pageInfo][hasNextPage] <> false
, each [
Result = try fnGetComplianceFW(wfReportId, [afterCursor]) otherwise null
, afterCursor = Result[data][policyAssessments][pageInfo][endCursor]
]
, each [Result][data][policyAssessments][nodes]
),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
#"Converted to Table"
in
Source
Thanks in advance,
hauffa
Solved! Go to Solution.
rethink and change the exit condition
each [Result][data][policyAssessments][pageInfo][hasNextPage] <> false
Thank you. I ended up going with this. It seems to be working.
, each List.IsEmpty([Result][data][graphSearch][nodes]) = false
rethink and change the exit condition
each [Result][data][policyAssessments][pageInfo][hasNextPage] <> false
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |