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,
PowerPaddy
9 years agoFrequent Visitor
Thank you.
IBM gives the description of the DATEDIFF function on their website...
"The result will be the integer portion of the number of months between the two dates, with any fractional component truncated."
I will have to count number the number of days instead as a workaround.
v-sihou-msft
Microsoft Employee
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,