Forum Discussion
Help with DateDiff
Hi GJUDGE ,
I have added a row to simply reproduce data as you said your actual data contains many months data.
My first measure returns the date diff for each changed .
Below will return the diff between the latest two date:
Measure 2 =
var _last=CALCULATE(MAX('Table'[Construction Start Date]),ALLEXCEPT('Table','Table'[Project]))
var _pre= MAXX(FILTER(ALL('Table'),'Table'[Project]=MAX('Table'[Project]) && [Construction Start Date]<_last),[Construction Start Date])
return DATEDIFF(_pre,_last,DAY)
If it is still not your expected,please show me what you want .
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- GJUDGE4 years agoHelper II
Anonymous I really appreciate your help. When I try your latest measure on my actual data I still get the incorrect result. Below is project A. COD date is the same as construction start date. When I use either of your two measures, I get a difference of 153 days when this should be zero (i.e. the COD date hasn't changed in the most recent two months). I hope that makes sense!