Forum Discussion
PowerPaddy
9 years agoFrequent Visitor
DATEDIFF month interval not working as expected.
Hello again, I'm using the DateDiff function to work out after how many months a policy was cancelled but it's not giving me the expected results. Cancellation Month = DATEDIFF([POLICYSTARTDAT...
- 9 years ago
To get more accurate "MONTHDIFF", you can create a column like below:
Cancellation Month = ( 1 * ( [CANCELDATE] - [POLICYSTARTDATE] ) ) / DAY ( EOMONTH ( [CANCELDATE], 0 ) )Regards,
Harry_Long2
9 years agoRegular Visitor
How would you get it so that the function returns 0 if the difference between the two dates is less than one exact month? For example, if the start date is Jan 31st and the cancelled date is 1st Feb, we get 0 rather than 1.
Thanks!
Greg_Deckler
Community Champion
9 years agoWell, that's sort of going to depend on your definition of 1 exact month I suppose. You could probably get close with something like this:
Column = MROUND([DateCancelled]-[Date]*1.,30)/30