Forum Discussion
Anonymous
7 years agoNot applicable
Month DateDiff round down to nearest month
Hi Everyone,
When I'm using the DateDiff Function to get the difference between two dates it works fine, however it rounds up my dates and I would like to round this down. E.g if the difference in months is 16 months and 16 days, it rounds it up to 17 months . However I would like to round down to 16. Similarly if the difference is 23 days, I would like it to round down to 0 month as opposed to 1 etc. I have tried using INT(DateDiff(XXX) however the issue is still the same.
Thank you in advance
P
When I'm using the DateDiff Function to get the difference between two dates it works fine, however it rounds up my dates and I would like to round this down. E.g if the difference in months is 16 months and 16 days, it rounds it up to 17 months . However I would like to round down to 16. Similarly if the difference is 23 days, I would like it to round down to 0 month as opposed to 1 etc. I have tried using INT(DateDiff(XXX) however the issue is still the same.
Thank you in advance
P
Hi Datediff in always ROUNDUP, for Always rounddown you may use -1 like this:
diference = DATEDIFF(Table1[Column1];Table1[Column2];MONTH)-1
5 Replies
- rafaelmpsantosResponsive Resident
Hi Datediff in always ROUNDUP, for Always rounddown you may use -1 like this:
diference = DATEDIFF(Table1[Column1];Table1[Column2];MONTH)-1- AnonymousNot applicable
This is not acceptable solution. Subtracting one will create problems for you in other situations
- wbeckRegular Visitor
Correct, the solution is not to subtract 1. Any ideas what the solution is? I'm trying to do a calculation for Years of Service. Some of the values are getting rounded up (i.e., 5 or more months).
- AnonymousNot applicableThank you 🤗🤗
- v-jiascu-msftMicrosoft Employee