How to handle Nulls in Dynamics CRM Calculated Fields

One of the little wrinkles with calculated fields is that they cannot handle nulls and so if one of the values in the calculation is null then the calculated field value is null. 

In this example I have four custom fields on the opportunity entity to track the customers estimated sales by quarter.

The calculated field that totals the four custom fields.

A way to avoid this is to create a calculated field for each nullable sales field. This new calculated field returns zero if the sales field does not contain data.

I will then use the new fields in the total calculation field.

The total is now calculated even if the user does not enter values for all four sales quarters. I like this approach as it does not require any coding or populating nullable fields with zero values unnecessarily.

Leave a Reply