There are two main types of calculated fields.
Regular (computed from individual fields) is used for calculations involving either numeric or date fields on the object’s layout. For example, you could define a number field that calculates the total price based on the quantity times the unit price. Or, you could have a date field that calculates the Term End Date based on the Effective Date of the contract plus the Term Length in Years.
Aggregate (computed from associated line items) is used to calculate values from Custom Object line items on a record (line item totals or sub-totals). So for example, you could add a field that adds up the value of each line item in a Products or Services type custom object.
Defining a Regular Calculated Field
Open the layout in Type Manager, add a Number Field or Date Field and define the General Properties as usual.
Open the Calculation tab.
Toggle Calculated Field on.
Select the Calculation Type: Regular; computed from individual fields.
Select an option for handling null values (blank fields)
Handle null values as null (means Don't Calculate if any field in the formula is null)
Handle null values as 0 (means Calculate anyway and treat any field in the formula as a 0 in the calculation)
For calculations involving date comparisons, select how to display the date difference: Days, Weeks, Months, Quarters or Years,
Construct the calculation formula by adding rules. As you build the calculation, the calculated formula is displayed in the Summary section at the bottom.
Click
to add a new row. NOTE: the first row is added for you.Select an option from the dropdown.
For Field, select a field from the list of all numeric and date fields in the main record (fields from related records are not supported).
For Constant, enter a static value in the text box to be used in the calculation.
For Current Date, no additional data is needed.
Choose an operator. The available operators are
.Add more rows or groups as needed.
Click
.Click
to save the layout.
Numeric Field Example
Calculate the Total Price as the Unit Price times the Quantity
Date Field Example
Calculate the Term End Date as the Execution Date plus the Term Length in Years.
Defining an Aggregate Calculated Field
Open the layout in Type Manager, add a Number field and define the General Properties as usual.
Select the Calculation Tab.
Toggle Calculated Field on.
Select the Calculation Type Aggregate: Computed from the associated line items
Select an aggregate function:
Sum
Average
Count
Min
Max
In Line Item Type, select the Custom Object on which to perform the aggregate function.
In Aggregated Field, select the field within the selected Custom Object on which to perform the aggregate function.
Optional: To limit which items are part of the calculation, toggle Create Aggregate Rule on and then add a rule under the “Include Items Where” section.
Click
.Click
to save the layout.
Aggregate Example
Add up the total value of all service fees (line items) in a contract.
Aggregate Rule Example
Refine the previous calculation so that the system only calculates fees where the Service Type is Internet.