Calculated fields in Dynamics CRM are useful for calculating the number of days remaining between today's date and future dates, like expiration dates for example. Calculated fields work well on forms and show the latest value on a sub grid. However, there is a catch. If the expiration date has already past, the days remaining will be shown as a "–ve" value, which you do not want. In today's blog, we will show you how to manipulate the value of days remaining between today and the expiration date. Let's begin!
Ideally, the number of days between dates should be a positive whole number or zero. In order to achieve this, we utilize a solution using two calculated fields and described in the steps below:
1. First, you will need to create one calculated field and use the formula to calculate the exact remaining days between today and the expiration date as shown below. The field will now display the number of remaining days as calculated.
2. Create another calculated field and add a condition to check the other calculated field for the value. If the value is less than or equal to 0, then show the value of this field as 0. Otherwise, the field should show the value as is in the other field.
With these steps in place, the "–ve" value will never be displayed. That's all for the blog today folks. Get more tips and tricks like this one by subscribing to our blog!