Roll up Summary Field in Salesforce

A roll-up summary field in Salesforce can be used to summarize the data of all the child records and display the information on the master record.

Roll Up Summary in Salesforce is one of the important topics in Salesforce, so I decided to write a complete article on this.

In this Salesforce tutorial, I will explain the roll up summary field, and how to create a roll up summary field in Salesforce lightning and classic interface.

Roll up Summary Field in Salesforce

In the roll-up summary, we get the records on a child object instead of getting from the parent object after getting the records on the child object store and regenerate this data value anywhere any record on the detail record is saved.

It automatically shows the output on the master records while summing up data from a set of related detail records.

Consider a scenario, suppose there are two objects. Object A and the Object B and these two objects are related to each other in which A is on one side of the relationship and B is on the many sides of the relationship.

The multiple B records are associated with single A records. In that case, we summarize the field value on all the child records and display that field value on the master record in that situation we create a roll-up summary field.

Roll Up Summary can be Created on which Relationship in Salesforce

The roll up summary field can be created on Master-Detail Relationship. This shows that the parent object must have a master-detail relationship with the child object. In Salesforce Master-Detail Relationship establishes one-to-many relationships between two objects.

  • Parent Object: The object in which we create a roll-up summary field, and this object is master in the master-detail relationship.
  • Child Object: The object on which the roll up summary field is, and this object is a detail object in the master-detail relationship.

Create a Roll up Summary Field in Salesforce

The creation of roll up summary field in Salesforce is available in the contact manager, group, professional, enterprise, performance, unlimited, developer, and database.com edition.

See also  How to remove App Page from App in Salesforce Lightning

You can also create a roll up summary field in both the Salesforce Lightning and Salesforce Classic user interface. If you want to learn, then read the complete post.

How to Create Roll Up Summary Field in Salesforce Lightning

Here we will learn how to create a roll up summary field in Salesforce Lightning.

Before creating the roll up summary field, you should have at least that parent object that has a master-detail relationship with the child object. Otherwise, the roll up summary field is not created.

The following are the steps to create roll up summary field in Salesforce Lightning:

1. Click on the Gear icon –> Select the Setup option –> Click on the Object Manager tab.

Roll up summary in Salesforce

2. Select the opportunity object and then select the field and relationship option that is present in the left sidebar.

Roll up summary field in Salesforce

3. The field and relationship page is open. Click on the new option.

Roll up summary field in Salesforce

4. The new custom page is open under this page data type is present, click on the roll-up summary data type and click on the next option.

Salesforce roll up summary

5. Enter the details. Fill the field label. Here, we are filling the field label as Total Product then fill the field name and then clicking on the next option.

Salesforce roll up summary field

6. Now select the object to summarize.

Select the opportunity product, which is a summarised object –> select the roll-up type as count –> filter the criteria –> click on the next option.

Rollup summary field in Salesforce

7.  After selecting the roll-up type now establish the field level security and then click on the next option.

Salesforce rollup summary

8. After establishing the field level security the roll-up summary field is created click on save. The total product field is shown in the field and relationship item.

Create roll up summary field in Salesforce

9. Go to the APP Launcher, enter the opportunity in the search box, and select the Opportunity.

The object page is open where the record is present. Here we are selecting Card Item Detail and then clicking on the details tab.

The total product field is the roll-up summary field, which counts the total products that are present inside the cart item detail.

Create roll up summary field in salesforce lightning

Read: How to Create Public Groups in Salesforce

How to create a Roll Up summary field in Salesforce Classic

The following are the steps to create the roll up summary field in Salesforce Classic:

1. Go to the Setup –> Enter object in Quick Find Box –> Select the object.

Create rollup summary field in salesforce

2. Custom Object Page is open –> Select the USA Student object that is the parent object.

Salesforce rollup summary field

3. Now scroll to the bottom of the page there is a field and relationship section present.

See also  How to Merge Cases in Salesforce

Click on the new option and choose the field type. Here, we are selecting the roll-up summary field.

Create roll up summary field in salesforce

4. Now enter the details. Fill the field label. Here we are filling the field label as Sum of USA Student in the group, filling the field name, and clicking on the next option.

Salesforce create a rollup summary field

5. Now select the object to summarize. Here, we select the USA student in groups product in the summarised object and then select the roll-up type as MIN.

Now select the field to aggregate as the Created date after that filter the criteria and click on the next option.

Salesforce classic create a rollup summary field

6. After selecting the roll-up type now establish the field level security and then click on the next option.

Salesforce classic create roll up summary field

7. After establishing the field level security, now add this field to the page layout for this we click on the save button.

Create roll up summary field in salesforce

8. Now we come back to our custom object page and scroll to the bottom, there is a field and relationship section, and our Sum of USA Student in the group field is shown in the field and relationship section.

Salesforce rollup summary field is created

So, with this, we have learned how to create a roll-up summary field in Salesforce Classic.

Roll Up Summary Field Salesforce Example

There are multiple scenarios for which you need to create a roll up summary field in Salesforce. You can easily create the roll up summary for any of the scenarios defined in both Salesforce Lightning and Salesforce Classic by following the steps defined above.

Let us discuss some of the examples in Salesforce for which you can create a roll up summary field.

Example-1: Calculate Total Sales Amount

Let’s suppose you are working for a retail company that sells the product through multiple stores across different areas. Every store has its own sales reactions recorded in salesforce and we want to track the total sales amount for each area.

For this, you have two objects store and sales transaction, and create a roll up summary field named total sales amount with roll up type sum on the store object.

See also  How to Create a Dynamic Record Page in Salesforce

This sum of roll-up type calculates the sum of all sales transaction amounts. Transaction amount has currency field type.

Let us have a look at how to create roll up summary field with a Sum roll up type:

Roll up summary field salesforce

Example-2: Calculate Minimum Production Time

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 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 productions. Production time has a time field type.

Let us have a look at how to create roll up summary field with a MIN roll up type:

Roll up summary field salesforce Lightning

Example-3: Calculate the Maximum Quantity of Stock

Let us suppose you work for several stores that are spread across different cities. Every store keeps track of its inventory for various products. You want to recognize the maximum inventory level of every product across all stores.

Here are using two objects Product and Inventory, and create a roll up summary field named Maximum Inventory Level with roll-up type MAX on the Product object.

This maximum roll-up type calculates the maximum quality in stocks across all the inventory records. Maximum Quantity Stock is a number field type.

Let us have a look at how to create roll up summary field with a MAX roll up type:

Roll up summary field in Salesforce

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

Conclusion

I hope now you have an idea of the rollup summary field in Salesforce and how to create a rollup summary field in Salesforce.

I have also explained the different roll-up types in Salesforce, which use different fields to aggregate objects available in the Salesforce interface.

You may also like to read the following Salesforce tutorials.