Calculated fields support extended for Date/Time data types in Dynamics CRM 2015

By | July 15, 2015

Introduction:

Calculated fields was first introduced in Dynamics CRM 2015 and it further improved upon the ability to provide codeless solutions to power users to configure. You can learn more about its features from our earlier blog here.

It provided support for most CRM data types however the calculations and formulae supported for Date/Time fields were still limited.

With the latest Online update, they have enhanced the operations supported on Date/Time fields.

  1. DIFFINDAYS(start date or time, End date or time)
  2. DIFFINHOURS(start date or time, End date or time)
  3. DIFFINMINUTES(start date or time, End date or time)
  4. DIFFINWEEKS(start date or time, End date or time)
  5. DIFFINYEARS(start date or time, End date or time)
  6. DIFFINMONTHS(start date or time, End date or time)

The Rollup field has also been enhanced to support AVG as an aggregate calculation for Date/Time fields.

How does this help?

A very real scenario where this code be used is to calculate the Avg. time it takes for resolving a complaint.

The Actual Units fields in the Case entity calculates the total time spent on the case by adding up the times on the individual activities associated with the case. But what if you wanted to know just how long a case had been open – case createdon – case modifiedon.

Next it would be good to have the Avg. case resolution time per customer, to monitor if there are particular customers for which is usually takes too long to close a case. What we are looking out for here is Avg. Case closure time.

Walkthrough

Let us see how to go about getting this set up in no time.

  1. Add the Calculated field.

calculated fields

Since we have created a Duration field, we would calculate the difference between CreatedOn and ModifiedOn in minutes. Note. Duration field always expects the values to be provided in minutes.

calculated fields1

  1. Create the Rollup field.

              We will add the rollup field on Account to get the Avg. Resolution time.

calculated fields2

                       Rollup the time for only resolved cases.

calculated fields3

  1. Place both the fields on the Case and Account forms respectively.
  2. Now when you resolve the case, you will find that the case resolution time is auto calculated.

calculated fields4

  1. We quickly closed a few cases for this account so that the avg. could be calculated

calculated fields5

  6.   Now lets check how it looks on the Account form

calculated fields6

Conclusion:

Though this takes a step further in supporting date/time data type in Calculated and Rollup fields, Rollup fields still do not support Date conditional operators like Last X months/years etc. So if I wanted to get the avg. case closure time in the last 6 months, I still cannot do that. Hoping to see this included in future version to support a full code-less power-user configuration solution.

Its just not this. Have a look at our mapping solution for Dynamics CRM, Maplytics which works from with CRM. Email us on crm@inogic.com for a trial or if you would like to see a live demo.