Quite a few times it becomes necessary to have calculated fields on a form, for example, we may have a few fields and we want to also have the total on the form. Prior to CRM 2013, you would need to do this via JavaScript and then 2013 introduced Business Rules, which can be used to place a calculated value in a field. CRM 2015 gives us a new Field Type - Calculated Field.
Let's take a hypothetical example, where we have a few fields and we need to display the calculated total. So we have the actual item cost, the assemble cost and optional accessory cost. We want to have a field for the total cost of the assembled item.
The process is outlined below:
- Lets go ahead and create the three fields.
- Item Cost
- Assembly Cost
- Optional Accessory

2. Next, lets add the Calculated Field. Make sure you set the Field Type as "Calculated".

3. Now, we need to add the calculation logic. Click on the "Edit" button.
4. This brings up the calculation business rule:
- Enter the condition, here we are just entering one condition to check if the Item Cost is greater than 0 or not.
- Enter the calculation logic. Select the field and then type in the operation, "+" in our case and then select the next field.

5. Once the Calculation has been setup, save the business rule, the field and add the field to the Form. Publish the customization.
6. In CRM, open the form and enter the value for Item Cost, Assembly Cost and Optional Accessory.
7. Then save the form. On Reload, the value of the Total Cost will be displayed.

Calculated fields are also closely related to Roll-up fields, wherein you can calculate across child records. We hope this answered any lingering questions! Make sure to stop by our main blog page for other great Dynamics CRM tips and tricks! Or if you are specifically interested in CRM 2015 we have created a dedicated page!
Happy CRM'ing!.
Thanks for your blog, Power Objects!! I trust this is a powerful feature in CRM 2015.
Is it possible to find the number of days between two date and time fields this way?
for eg: days_between (createdon,escalatedon)
Sameera-
I had the same question, and could not figure a way to do it in Dynamics CRM 2015. I ran across this much more detailed explanation from Sonoma Partners which confirms that it is not currently possible. http://blog.sonomapartners.com/2014/09/dynamics-crm-2015-calculated-and-rollup-fields.html
Same problem we faced for our one of the requirement on MS CRM Express mobile forms.
For Example I have one random date (13-July-2015) in MS CRM 2015 Express forms. So with the help of calculated field date functions I would like to get remaining months left in current year (in this case the answer is 5) . This 5 value I need to use in some other calculation. Till now this is not possible with Calculated fields. So as far now we have only one solution for this that is Plugin.
Kindly suggest some formula if you have.
Hi Varun - if you have crm online, this will be avalble with the new crm 2015 Update 1. For the onpremises folks we'll have to wait until the fall release.
https://community.dynamics.com/crm/b/crmcat/archive/2015/05/14/the-new-features-of-crm-2015-update-1-amp-how-to-use-them
Ohh Joe Really. Let me see.
You can measure days. My example
DiffinDays(Createdon, Closedondate)
I created a whole number field called "Time in Opportunity" as a calculated field and then entered the above calculation.
I am in a CRM 2015 online instance
Joo I've checked this is included only DiffinDays(created on, NOW()) . Which will not even helpful for my case.
How can I code for adding two numbers from two fields on LEAD form and putting result in third field on that same form in Dynamics CRM 2015 online? I am creating a plug-in and there is no function like (entity.setAttribute) but have a function (entity.getAttribute). So I am failing to put the result in third field.
Is there any way to override calculated fields? Creating a "Lead Closed Date" using the Status Reason and "Now()" calculation and we have past Leads that have been closed before "Now()" that we need to preserve.
Is there any way to override calculated fields? Creating a "Lead Closed Date" using the Status Reason and "Now()" calculation and we have past Leads that have been closed before "Now()" that we need to preserve.
Is there any way to override calculated fields? Creating a "Lead Closed Date" using the Status Reason and "Now()" calculation and we have past Leads that have been closed before "Now()" that we need to preserve.
Is there any way to override calculated fields? Creating a "Lead Closed Date" using the Status Reason and "Now()" calculation and we have past Leads that have been closed before "Now()" that we need to preserve.
hello , do I have to fill the operation ? I just want to add some fields anyway ...