Forum Discussion
Anonymous
6 years agoNot applicable
List dates between two dates
Hi all, I'm looking for a formula to list dates between 2 dates. Suppose I have the following example: Column A) InitialDate: 19/07/2019 Column B) EndDate: 19/10/2019 so, I would like to get as r...
- 6 years ago
Hi Anonymous
you don't use it as a function. Then the "each" isn't ambigous any more.
Try this for result instead:
Result = List.Transform({0..NoOfIntervals}, (x) => Date.AddMonths([FROM], x))
ImkeF
Community Champion
6 years agoHi Anonymous
this function should get you there:
(From as date, To as date) =>
let
NoOfIntervals = (Date.Year(To)*12+Date.Month(To))-(Date.Year(From)*12+Date.Month(From)),
Result = List.Transform({0..NoOfIntervals}, each Date.AddMonths(From, _))
in
Result