Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not 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
1 ACCEPTED SOLUTION

Hi Datediff in always ROUNDUP, for Always rounddown you may use -1 like this:


diference = DATEDIFF(Table1[Column1];Table1[Column2];MONTH)-1

View solution in original post

5 REPLIES 5
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

How did you create the formula? It seems right to your needs. Please refer to the snapshot below.

Month-Date-Diff-round-down-to-nearest-month

 

Best Regards,
Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Datediff in always ROUNDUP, for Always rounddown you may use -1 like this:


diference = DATEDIFF(Table1[Column1];Table1[Column2];MONTH)-1

This is not acceptable solution.  Subtracting one will create problems for you in other situations

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).

Anonymous
Not applicable

Thank you 🤗🤗

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.