Contact Us Today!

Working with Calculated Fields in Dynamics 365

Working with Calculated Fields in Dynamics 365

What is a calculated field?

Calculated fields perform calculations using data from other fields and return the result.  Calculated fields do not require knowledge in programming and are easy to set up.

Let’s start by creating some fields.

Create 2 fields and set the Data Type to Decimal Number and the Field Type to Simple.  The default decimal number settings will do for this demonstration.  Next, create a third Decimal Number field but this time, set the Field Type to Calculated.  Click "Edit" next to the Field Type.

 

Here, we can set up the calculation of the first two fields.  Click into the area under the Action tab to populate a drop-down list of fields in the entity.  Find and select the first field for the calculation, add the operator and finally, add the second field.  Adding a space before and after the operator helps the readability of the equation.  Click the check mark at the bottom of the screen and then Save and Close.  Head over to your form to test the new calculation.

 

 

Adding calculated fields is as easy as that.  But let's add some real-world context to this calculation.

Suppose we need to find the difference of two fields, but if that difference results in a negative number, we just want to see a 0.  In order to do this, we need to create a condition.  There are several ways of creating conditions to get our desired output, but let's go with an easy, logical condition.

 

 

Here, we added the condition "If Field for Calculation 1 is greater than Field for Calculation 2."  We added the same operation that we started with: subtract the first field from the second.  And then, we added an Action under the Else tab that sets the Calculated Field to 0.  This way, the calculation only happens if the the first field is larger than the second.  If the second field is larger than the first, the result would be a negative number, so rather than perform the calculation, we've set it to just display a 0.

 

 

Some limitations

  • There is a limit to the amount of calculated fields per entity.  It is important to check your software version to determine how many calculated fields you can create before implementing them.
  • Calculated fields cannot trigger workflows.  Attempting to call a workflow on the change of a calculated field will not work.

Beringer Technology Group is always here to provide expert knowledge in topics like these. Contact us with any questions you may have.

Beringer Technology Group, a leading Microsoft Gold Certified Partner specializing in Microsoft Dynamics 365 and CRM for Distribution. We also provide expert Managed IT ServicesBackup and Disaster RecoveryCloud Based Computing and Unified Communication Systems.