The Roll-Up Summary Field is quite similar to a Formula Field, while the Formula Field calculates its values based on fields within the object, the Roll-Up Summary Field calculates its values from the set of related records(such as the records found in the related list).
Before I go on describing what a Roll-Up Summary Field is, it’s essential to have an understanding of how Master-Detail Relationships work.
A Master-Detail Relationship links two objects together in such a way that the Master record controls specific behaviors (Sharing and Security settings) of the detail record.
You can create the Roll-Up Summary Field on the Master object in a Master-Detail relationship. The value displayed is based on the value of the fields in the detail record.
Example: Account (Master Record) and Opportunities(Detail record).
Roll-Up Summary Field
A Roll-Up Summary Field displays a value on the Master Record page based on the values of the fields in the Details records. You can display the count, sum, the maximum or minimum value of fields in the related list.
In layman’s terms, the Roll-Up Summary Field compiles data from a child object to a parent object as long as they share a Master-Detail Relationship.
Example: Create a Roll-Up Summary Field on the Account Object that displays the Sum of all associated Opportunities.
Let’s take a look at a few different types of summaries that can be used:
How to create a Summary Field
Let’s create a Summary Field on the Account Object that’s going to display the total number of Opportunities from the Account.
1. From Setup, open Object Manager and select Account.
2. From the sidebar, open Fields & Relationships. Click New.
3. Select Roll-Up Summary for Field Type. Click Next.
4. For Field Label, enter Opportunity Count. Click Next.
5. Select the following:
Summarized Object: Opportunities
Roll-Up Type: COUNT
6. Click Next, Next, and Save.
To see what we’ve created, open any Account record page and find the Field and Opportunity Count under the Details tab of the record. It should be similar to this:
Examples of Roll-Up Summary Fields
Sum of Opportunities
We can create a roll-up field on the Account object summarizing all the related Opportunities. The SUM of all related Opportunities will be displayed here.
We can create a roll-up field on the Account object that displays the total expected revenue from all related Opportunities (The SUM of Expected Revenue (Field to Aggregate) from all related Opportunity records).
Maximum List Price of An Opportunity
A roll-up field can be created on the Opportunity object that displays the Product with the lowest price related to an Opportunity( MAX of List Price).