Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications

|

How to Calculate Number of Days Between Two Date and Time Fields

Post Author: Joe D365 |

In today's blog, we are going to demonstrate how to calculate the difference in the number of days between two date and time fields. This functionality also works for the Date & Time and Date Only field as well as the Date Only and Date Only fields. Which means that you can use any possible combination of custom or out-of-the-box Date fields.

In the scenario below, we will estimate the number of days it took the Sales Rep to qualify a Lead to an Account.

Lead Creation Date

First, we will create a Lead Created On field that will hold the information we already possess on the Lead record. In the scenario below, we are using the Date & Time field, as the Created On field on the Lead record is the same format.

time fields

 Calculated Field

The next thing we have to do is to create a Calculated field type Decimal Number. The reason we have selected Decimal Number is because we are using two Date & Time fields as Dynamics 365 includes the Created on Time as part of the calculation. However, we are interested only on the number of days so we will set the Precision value to zero (0). You also can use a Whole Number field type based on your project requirements.

time fields

Calculation Logic

Once you have saved the field, click on edit and set up the logic. In this scenario, we will use the DiffinDays function and specify the start and end date and time. Although, when using the DiffinDays function within the brackets it specifies Date & Time field, the functionality equally works if you select Date Only field type.

time fields

In Action

After saving and publishing the changes, we can go back to the form and test the new function.

time fields

There you have it! For more tips and tricks for using Microsoft Dynamics 365, keep checking our blog!

Happy Dynamics 365'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends