Roll-Up Summary Field in Salesforce

While working as a Salesforce Administrator, I was assigned the task of calculating the sum of the amount fields from all related child records and displaying that total sum on the parent record. We can use a formula to calculate it, but the rollup summary field makes it very easy.

In this Salesforce tutorial, we will learn about the roll-up summary field in Salesforce. In that, we will discuss the following points:

  • What is the roll-up summary field in Salesforce?
  • Limitations of rollup summary field in Salesforce.
  • Example 1- Create a roll-up summary field in Salesforce.
  • Example 2- Create a roll-up summary field using filter criteria in Salesforce.
  • Example 3- Create a roll-up summary field using MIN type in Salesforce.

What is the Roll-Up Summary Field in Salesforce?

In Salesforce, the rollup summary field is used to aggregate or summarize the data of related child records and display that data on the parent record in a master-detail relationship.

  • We can create a rollup summary field only when two standard or custom objects are in the master-detailed relationship.
  • We can create the rollup summary field on the parent or master side only.
  • The roll-up summary field is read-only. We cannot edit or modify it.

There are Four Roll-Up Types in Salesforce

The following roll-up types are used as functions in the roll-up summary field. These functions calculate data automatically and display it on the parent object.

  1. COUNT: This function counts the total number of related child records and displays them on the parent object in the rollup summary field.
  2. SUM: This function calculates the sum of the fields from all related child records.
  3. MIN: This function displays the minimum value from the related child record on the parent record.
  4. MAX: This function displays the maximum value from the related child record on the parent record.

Note: We don’t need to select a particular field while using the count function. However, the other three functions perform on a particular field.

Limitations of Roll-Up Summary Field in Salesforce

Following are the limitations of the rollup summary field in Salesforce.

  • In the roll-up summary, we can perform only four types of operations.
  • Then, we cannot create a rollup summary field on the lookup relationship.
  • Then, for the SUM, MIN, and MAX operations, we can use only certain fields, such as number, currency, and percentage fields.
  • There is a limit to creating a rollup summary per object. We can create only 25 rollup summary fields, but it can vary depending on the Salesforce edition.

Example 1- Create a Roll-Up Summary Field in Salesforce

For example, I was working on an account and opportunity object, and I was assigned the task of calculating the number of records related to a particular parent record on the account.

  • So here, to calculate the child record, the simplest way is to use the roll-up summary field on the parent(account) object.

We can create a rollup summary field in Salesforce using the following steps.

1. Click on the Gare icon. -> Setup. -> Object Manager.-> Account. Then click on Fields & Relationships.

  • Now, we are creating a new rollup summary field. To do so, click on the New button.
Roll-Up Summary Field in Salesforce

2. Select Roll-Up Summary Data Type and then click on the Next button.

roll up summary field in salesforce

3. Now, enter the Field Label. It will be displayed on the record detail page. The Field Name is the API Name, and it will automatically populate.

rollup summary in salesforce

4. Then, select Summarised Object. As you click on it, it will display all objects that are in a master-detail relationship with the account object.

  • Select Roll-Up Type, basically, these are the functions. Here, as per our scenario, we have to select the Count roll-up type.
  • In the filter criteria I have selected, all records should be included. In the next option, we will see another option.

After that, click on the Next button.

roll up summary field salesforce

5. Then select Field Level Security, to which profile this field will be available to use. Then add the on the account Page Layout. Click on the Save button.

rollup summary field in salesforce

6. Now, to check whether how the count rollup type works, navigate to the account object tab and select any account record you will see the rollup field with the field label that you entered.

In that field you can see, their is dispyaed number of record which are related to the selected account.

roll up summary salesforce

This is how we can create a rollup summary field in Salesforce.

Example 2- Create a Roll-Up Summary Field Using Filter Criteria in Salesforce

In this scenario, we will see how to use filter criteria in the rollup summary field. Let’s take an example: I was assigned the task of calculating the total amount of all related child records from an opportunity object whose opportunity Stage is ‘Closed Won.’

In the following steps, I have explained how to create a roll-up summary field using filter criteria in Salesforce.

1. Click on Setup. -> Object Manager. -> Select object. Here, I selected the Account object.

  • Then click on the Field & Relationships. -> Click on the New button.

2. Select Roll-Up Summary Data Tye and click the Next button.

  • Now, enter the Field Label. It will be displayed on the record detail page. The Field Name is the API Name, and it will automatically populate.

3. Then, select Summarised Object. Then, select Roll-Up Type. Here, as per our scenario, we have to select the Sum roll-up type.

  • Then, while using the sum rollup type, we must select the Field to Aggregate option. As you click on it, it will display a summarised object field that can be calculated. Here, I selected the Amount field.
  • In the Filter Criteria, we will now select only records meeting certain criteria; as you click on it, you need to define the criteria.
  • Stage = Closed Won.

That means now this rollup summary field calculates the sum of the amount of only those records, which is equal to the defined criteria and that sum will display on the parent record.

After that, click on the Next button.

how many rollup summary field in salesforce

4. Set the Field Level Security, add a field on the Page Layout. and then Save the rollup summary field.

5. Now, navigate to the account object tab and select any record. You will see that I created two rollup summary fields for the sum of amount.

  • The first one is with a filter, and the second one is without a filter, and there is a clear difference in both fields.
salesforce rollup summary

This is how we can create a roll-up summary field using filter criteria in Salesforce.

Example 3- Create a Roll-Up Summary Field Using MIN Type in Salesforce

Let us suppose you work for a manufacturing company that makes various products across different manufacturing plants. Every workshop has its own set of production run and recorded in the Salesforce and you want to trace the minimum production time for every product across every workshop.

  • In Salesforce, we have two objects, Production, and Manufacturing Plant, and we will create a roll-up summary field named Minimum Production Time with roll-up type MIN on the Production object.
  • This minimum roll-up type calculates the minimum production time across all the related manufacturing plants.
what is roll up summary field in salesforce

With this, we have seen a few possibilities for using the Salesforce roll-up summary field.

Conclusion

I hope you now have an idea of the roll-up summary field in Salesforce and its type, as well as roll-up summary field types. We also have seen limitations of the roll-up summary field.

Then, we have seen a real-time example, and I explained how we can create a rollup summary field with and without using filter criteria in Salesforce.

You may also like to read the following Salesforce tutorials.

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.