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!
I am trying to generate a list of months based on a contracts' start date and duration. I keep getting an error when making the loop threshold reference the duration column instead of a static number (which does work).
List.Generate(()=>[x=[Start Date],i=0], each [i]<[Months_duration], each [i=[i]+1,x=Date.AddMonths([x],1)], each [x])
Solved! Go to Solution.
You can try this...
= Table.AddColumn(PREVIOUSSTEP, "Custom", each let startDate = [Start Date], duration = [Months_duration] in List.Generate(()=>[x=startDate, i=0], each [i] <= duration, each [i=[i]+1, x=Date.AddMonths([x], 1)], each [x]))
Proud to be a Super User! | |
You can try this...
= Table.AddColumn(PREVIOUSSTEP, "Custom", each let startDate = [Start Date], duration = [Months_duration] in List.Generate(()=>[x=startDate, i=0], each [i] <= duration, each [i=[i]+1, x=Date.AddMonths([x], 1)], each [x]))
Proud to be a Super User! | |
Awesome! that worked! i did try creating the variable in the within the list but pulling out before worked! thanks so much!
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 |
|---|---|
| 11 | |
| 10 | |
| 6 | |
| 6 | |
| 6 |