Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Unanswered

Difference in Month

Posted on by 1,217

Hi, 

I'm creating 2 date field and 1 decimal number field. The decimal number field is set to use calculated field.

In the formula, I set it as DiffInMonths(startdate, enddate). When start date as 1st May and end date as 1st June, the result is 1.0, but if the end date is set as 2nd June, the result is 2.0.

How is this DiffInMonths function work?

Thanks.

Regards,

Teh

  • YA TEH Profile Picture
    YA TEH 1,217 on at
    RE: Difference in Month

    Hi Rakesh,

    Thanks. Will try log a case for this issue.

    Regards,

    Teh

  • RakeshJ Profile Picture
    RakeshJ on at
    RE: Difference in Month

    YA TEH,

    As stated in https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/define-calculated-fields the behavior should be as defined. 

    DIFFINMONTHS (date and time, date and time) Returns the difference in months between two Date and Time fields. If both dates and times fall on the same month, the difference is zero. Whole Number

    I tested your scenario in my vanilla organization i.e. created two date field i.e. StartDate and EndDate. Further created third field "TimeTaken" (calculated Field) as a whole number field.

    When I look for 1st May to 1st June it shows as 1

    pastedimage1589205099697v3.png

    When I change to 2nd June, it shows as 2 

    pastedimage1589205135057v5.png

    When I select End date to be of same month, it should show as 0, however it shows as 1 which is not an expected behavior. As this is reproducible in vanilla org, I would suggest you to please raise a support ticket with Microsoft as this needs to be investigated by Support Reps.

    pastedimage1589205183058v6.png

    If this is helpful, kindly mark this as a Suggested answer.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans