Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi Community,
I am using List.Generate to create a loop function in power query.
This loop is running on start date & end date for each iteration, which I am getting from within the loop.
The starting dates, I have defined , currently within the List.Generate() function. Can these dates be defined out of the list.Generate function.
ie
If I can use startdate and enddate commented in green, instead of hardcoding in List.Generate() here in Red.
I tried using it, but it could not recognize those values.
//StartDate = #date(2018,01,01),
//EndDate = #date(2018,01,31),
GeneratedList =
List.Generate(
()=>[StartDate = #date(2017,11,01),EndDate = Date.AddMonths(StartDate,1),res =FnGetOnePage(StartDate,EndDate)],
each [StartDate] < DateTime.Date(DateTime.LocalNow()),
each [StartDate = Date.AddMonths([StartDate],1),
EndDate= Date.AddMonths([EndDate],1),
res = FnGetOnePage(StartDate,EndDate)
],
each[res][profiles]
),
Result = Table.FromRecords(List.Combine(GeneratedList))
in
ResultRegards
emudria
Solved! Go to Solution.
Not exactly like yours, but this worked for me:
let
StartDate = #date(2017,01,01),
EndDate = #date(2018,01,31),
GeneratedList = List.Generate(()=>StartDate, each _ < EndDate, each Date.AddMonths(_,1))
in
GeneratedList
Not exactly like yours, but this worked for me:
let
StartDate = #date(2017,01,01),
EndDate = #date(2018,01,31),
GeneratedList = List.Generate(()=>StartDate, each _ < EndDate, each Date.AddMonths(_,1))
in
GeneratedList
@Anonymous,
Glad to hear that. You may help accept solution. Your contribution is highly appreciated.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 54 | |
| 43 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 123 | |
| 106 | |
| 44 | |
| 32 | |
| 24 |