Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
I would like create a loop within a loop using the Power Query advanced editor.
I want to loop through all group Ids in a list, then for each group id, loop through the pages returned in the API reponse and add this to a table. Any clue on how to do this? Thanks
Below is the code that I currently have which only supports pagination so far.
let
group_ids = "X", "Y", "Z"
base_url = "https://devcloud.net",
getPage = (page_number) =>
let
relativeurl = "/api/v4/groups/" & group_id & "/epics?per_page=100&page=" & Text.From(page_number),
url = "https://devcloud.ubs.net",
headers = [
Authorization = "Bearer Token"
],
response = Json.Document(Web.Contents(url, [RelativePath=relativeurl, Headers=headers])),
issues = response
in
issues,
iteratePages = List.Generate(
() => 1,
each let currentPage = _,
currentPageData = getPage(currentPage)
in
currentPageData <> {},
each _ + 1,
each getPage(_)
),
To run loop in Power Query the following videos of mine can help you
For next loop by List.Accumulate
https://youtu.be/G8PRbWuDcmQ?si=1ij5Jo7kg1RboWgz
Do-while loop by List.Generate
https://youtu.be/iDYCtvTWFvY?si=piTHDUHGDnbt1kqU
but I think your problem might be solved by List.Transfrom also, so if you couldnt find the solution after whatching the videos, please provide sample of your question and result table then I can help you over your data
Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?
As you can probably appreciate it is nearly impossible to help with API queries without access to said API (which you may not be willing to provide for understandable reasons)
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 7 | |
| 6 | |
| 5 |