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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Modulo function (remainder) in calculated field

(0) ShareShare
ReportReport
Posted on by

Hi,

This may have been asked before, but I can't find anything on it.  I am trying to create a calculated field on a form that will come up with a time difference between two entered, date/time fields in Days and Hours. In T-SQL, I would use the Modulo ("%") function, but can't find anything like that for Dynamics CRM.  Someone must have done this already, but I must be looking in the wrong places.

Any help is appreciated.

Thanks!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Ivan Ficko Profile Picture
    1,380 on at

    You will need to write some JavaScript or C# workflow step for such calculation, there is no way to do this by OOB CRM functionality.

  • Community Member Profile Picture
    on at

    I was kind of afraid of that and it is beyond my capabilities.  I can't believe no one has had a Sales Manager who wanted to know how long it was between when an opportunity or Case is created and when it is resolved (won or lost).  Thanks though, Ivan.

  • Community Member Profile Picture
    on at

    Although I have not done this, I think you should be able to do this with out of the box capabilities using some creative approach. For example, you can calculate the difference in hours (DIFFINHOURS), store it in a temp table using "create record" within the workflow, retrieve this value and divide the number by 24 and store the result in a whole number field in the temp table, then subtract this from the original number to get the hours, etc.

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Not sure if this is something you are ok with since you can use MOD or DIV in calculated fields, you are able to use DiffInDasys. Specify both dates and you will get the difference: DiffInDays(startdate, enddate)

    Hope this helps.

  • Community Member Profile Picture
    on at

    That is sure worth a try.  Thanks!

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans