Forum Discussion
Help - List.Generate dates with variable frequency in months
- 3 years ago
It might be a field access error.
Try
let freq = [FREQUENCY] in each Date.AddMonths( _ , freq))
It generates without issue once i added in this line
Thanks!
Hi ben-t,
Could you share the full code that worked for you?
I think I've tried every possible code with the above solution, but I still get an error.
Thanks!
- ben-t3 years agoFrequent Visitor
Hi GekkeHellie
this is the code i used
let freq = [FREQUENCY] in
List.Generate(
() => [Next job],
each Date.From(_) <= Date.From(Date.AddYears(Date.EndOfYear(DateTime.LocalNow()),1)),
each Date.AddMonths(_, freq))- GekkeHellie3 years agoRegular Visitor
Hi ben-t ,
Your answer definitely helped me into the right direction.
In the table there is a start date, end date and frequency and I also wanted to create a new row between the two dates based on de frequency.
My table looks like this:
But since I have a end date in a column, instead of a formula like yours, I still got a error.
So I also added the below line to the code:
let enddate = [End Date]
let freq = [Frequency] in
let enddate = [End Date] in
List.Generate(
() => [Start Date],
each Date.From(_) <= Date.From(enddate),
each Date.AddDays(_, freq))Thanks for helping me out!