web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Add +1 to the DateDiff result formula

(0) ShareShare
ReportReport
Posted on by 903

Hello,

I have two date fields start and end date in a form. I would like to calculate the difference between those dates which can be achieved using the below formula:

DIFFINDAYS(cr1b0_startdate, cr1b0_enddate)

Example: Start Date: 5/11/2022 - End Date: 5/23/2022
Total: 12 Days

According to the above formula, the result is 12 days, however, in our requirements, we need to add and wrap the formula with a +1 as a result because the real total should be 13 days.
aDDdAYFormula.png

What should be the updated formula to add +1 to DIFFINDAYS(cr1b0_startdate, cr1b0_enddate)?

Could you please provide an example to achieve the above requirements?

Any help is highly appreciated.

Best regards,
EBMRay

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: Add +1 to the DateDiff result formula

    Hi EBMRay,

    DIFFINDAYS() need two date and time value as parameter and return type is whole number. ADDDAYS() first parameter is whole number type, second is date and time type and return type is date and time.

    The reason you get this error is because you pass two whole number as parameter to ADDDAYS(). So you can first add 1 day to end date and then use DIFFINDAYS().

    Please try this expression:

    DiffInDays(cr884_startdate, AddDays(1, cr884_enddate))

    Test:

    pastedimage1653370820184v1.png

    Result:

    pastedimage1653370844298v2.png

  • EBMRay Profile Picture
    903 on at
    RE: Add +1 to the DateDiff result formula

    Hi ,

    Thank you so much for providing the above example, it worked perfectly.

    Will it be possible to exclude weekends and public holidays through the calculated fields or this is something that should be done in JS?

    Awaiting your response.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Add +1 to the DateDiff result formula

    Hi EBMRay,

    Calculated field can't do this. You should use JS.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Sahan Hasitha Profile Picture

Sahan Hasitha 169

#2
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 71

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 66 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans