Forum Discussion
bparikh
5 years agoRegular Visitor
Date difference in Months - Power Query
Hello Experts, I've two DateTime columns and am trying to find the difference in Months by adding a new column but getting an error. I'm using = Date.Month ([Date1] - [Date2]) Date1 & Date2 bot...
LeTapia
3 years agoNew Member
What about this function
(Date1 as date , Date2 as date)=>
let
Source =
List.Generate(
() => [y=Date.From(Date1)],
each [y] <= Date.From(Date2),
each [y = Date.AddMonths([y] ,1)],
each [y]
),
Months=List.Count(Source)
in
Months