Implement Roll-Up Summary Fields
While formula fields calculate values using fields within a single record, roll-up summary fields calculate values from a set of related records, such as those in a related list. You can create roll-up summary fields that automatically display a value on a master record based on the values of records in a detail record. These detail records must be directly related to the master through a master-detail relationship.
- A custom account field that calculates the total of all related pending opportunities.
- A custom order field that sums the unit prices of products that contain a description you specify.
Since roll-up summary fields are based on master-detail relationships, it’s useful to review object relationships before creating a roll-up summary field.
Master-detail relationships closely link objects together so that the master record controls specific behaviors of the detail and subdetail record.
|COUNT||Totals the number of related records.|
|SUM||Totals the values in the field you select in the Field to Aggregate option. Only number, currency, and percent fields are available.|
|MIN||Displays the lowest value of the field you select in the Field to Aggregate option for all directly related records. Only number, currency, percent, date, and date/time fields are available.|
|MAX||Displays the highest value of the field you select in the Field to Aggregate option for all directly related records. Only number, currency, percent, date, and date/time fields are available.|
Creating the Summary Field
- From Setup, open Object Manager and click Account.
- On the left sidebar, click Fields & Relationships.
- Click New.
- Choose the Roll-Up Summary field type, and click Next.
- For Field Label, enter Sum of Opportunities and click Next.
- The Summarized Object is the detail object that you want to summarize. Choose Opportunities.
- Choose the SUM summary type and choose Amount as the Field to Aggregate.
- Click Next, Next, and Save.
Here are more examples of detail data rolling-up to master records.
Date Opportunity First Created
Total Price of All Products Related to An Opportunity
Minimum List Price of An Opportunity
A roll-up field was created on the Opportunities object. List Price is summarized on the Opportunity Product object to find the product with the lowest price related to an opportunity.
- Number, currency, and percent fields are available when you select SUM as the roll-up type.
- Number, currency, percent, date, and date/time fields are available when you select MIN or MAX as the roll-up type.