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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
stribor45
Post Prodigy
Post Prodigy

Execute n times

This code works for me fine but as I can not hard code n and i would know it from "some other code" how would I make this into a loop that would run n times?

 

//some other code
in
     result1,
     a = Query1{0}[list],
     b = Query1{1}[list],
     ......
     n = Query1{n}[list]
     c = List.Combine({a,b,...n})
in 
     c

 

 

 

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

What about this? Just change Number 100 to your n value - it can be stored also in [Column1] for example, so replace 100 with [Column1] if you add this as custom column.

 

 

= List.Combine(List.Transform({0..100}, (n)=> Query1{n}[list]))

 

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

4 REPLIES 4
dufoq3
Super User
Super User

What about this? Just change Number 100 to your n value - it can be stored also in [Column1] for example, so replace 100 with [Column1] if you add this as custom column.

 

 

= List.Combine(List.Transform({0..100}, (n)=> Query1{n}[list]))

 

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

just realized that my n is in //some other code  and not accessible in that part of the code

If you mean in other query - in that case it is accessible.


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

it is inside Query1 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors