Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register 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!
| User | Count |
|---|---|
| 15 | |
| 8 | |
| 6 | |
| 5 | |
| 5 |