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!Get Fabric certified for FREE! Don't miss your chance! Learn more
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!
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 12 | |
| 12 | |
| 10 | |
| 6 | |
| 5 |