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!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live 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!
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 8 | |
| 7 | |
| 7 |