Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
This is my first time building something like this and I'm missing something really fundamental. I built a function in M called "Output" which takes text as a parameter and runs an API call using that text as the continuation token. The API call gets the results from the system in descending order starting with the most recent entry. This function works great on its own and returns this:
results | continuationToken | EarliestEntryDate |
List | nvjkfjhg9476rhfkf0y78 | 6/25/2025 |
The "EarliestEntryDate" field is the earliest date from the entries returned by the call. What I would like to do is repeatedly execute the "Output" function using the continuation token from the previous call until the "EarliestEntryDate" is less than a date of my choosing. To do this I tried following this guide and put together the following:
token_based_call =
List.Generate(
() => Output(""),
each List.Min(_[EarliestEntryDate]) > Date.FromText("6/15/2025"),
each Output(_[continuationToken]),
each _[continuationToken]
)
When I run this though I get this:
What am I doing wrong here?
Hi @rdorsey ,
Could you please let us know if your issue has been resolved, or if you're still experiencing any problems? Feel free to share if you need any additional details we're happy to assist further.
Regards,
CST Team.
Hi @rdorsey ,
Could you let us know if your issue has been resolved or if you are still experiencing difficulties? Your feedback is valuable to the community and can help others facing similar problems.
Thank You.
Hi @rdorsey,
As we haven’t heard back from you, we wanted to kindly follow up to check if the issue is resolved? or let us know if you need any further assistance.
If any response helped in resolving the issue, please mark it as "Accept as solution" and give kudos if you found it helpful.
Thanks and regards,
Anjan Kumar Chippa
Hi @rdorsey ,
Thank you for reaching out to the Microsoft Fabric Community. @AlexisOlson , has provided an good solution that follows recommended practices for using List.Generate, particularly for managing token based API pagination.
We encourage you to try this approach with your data and share your experience. Should you have any further questions or encounter any issues, please feel free to reach out.
Special thanks to @AlexisOlson, for the quick and detailed response.
Best regards,
Fabric Community Team.
Your syntax doesn't look right to me.
Compare to the examples in this highly-related article:
How to use List.Generate to make API Calls in Power Query M
Code snippet from the article:
List.Generate(
() => [ Offset = 100, Pokemon = GetPokemon(0) ],
each [Offset] <= 200,
each [ Pokemon = GetPokemon( [Offset] ), Offset = [Offset] + 100 ],
each [Pokemon]
)
Your code should probably look more like this:
List.Generate(
() => [ token = "", results = Output("") ],
each [results][EarliestEntryDate] > Date.FromText("6/15/2025"),
each [ token = [results][continuationToken], results = Output(token) ],
each [results]
)
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
70 | |
70 | |
38 | |
28 | |
26 |
User | Count |
---|---|
97 | |
88 | |
59 | |
43 | |
40 |