Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Loop over a table to make a serie of query

I would like to make a kind of a loop in Power BI M so that I can automatise the creation of a new table (lets call this ResultTable).

Right now, I have a table that I want to iterate throug.

mqje_0-1617177500276.png

This table is called "AllPickList" and I would like to make a funciton that will make a call to my API using these values.


In the exemple below, I have a piece of code that will make the API call, but it is limited to the first row of the table "AllPickList".
= (data as table) => GetPickListOptions(data{0}[Column1.id])

Best case scenario, I would like to iterate trhough my table until its empty, otherwise we can use an index with a set value (right now it is 182). Then I would like to put in a new table ("ResultTable") all the data fetched from my API call thanks to the function GetPickListOptions which take an ID from "AllPickList". 

I am stuck on this, so if anybody can help me with this, this is much appreciated. 

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hello @Anonymous ,

 

add a new column and then use the function.

The function you can create in another query.

This should lead you in the right direction:

Chris Webb's BI Blog: Using The Invoke Custom Function Button In Power BI Chris Webb's BI Blog (crossjoin.co.uk)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

2 REPLIES 2
selimovd
Super User
Super User

Hello @Anonymous ,

 

add a new column and then use the function.

The function you can create in another query.

This should lead you in the right direction:

Chris Webb's BI Blog: Using The Invoke Custom Function Button In Power BI Chris Webb's BI Blog (crossjoin.co.uk)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
Anonymous
Not applicable

I can't believe it was this simple, thank you so much !

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.