Summarizing Roll Up Summary Field…
Roll Up Summary Field is used in a master-detail relationship to calculate values in a related record of a master record.
Roll Up Summary Field is available in both classic and lightning experience.Summary fields summarize the values from records on a related object, so the object on which you create the field should be on the master side of a master-detail relationship.You can review permissions and required and the Salesforce editions for which Roll Up Summary Field is available from help article
The value calculated by a roll up summary field on a detail record is based on pre-defined functions such as count, sum, min, max which is then displayed by a custom field on a master record.Below are the predefined functions as well:
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.
You can check more about implementation tips,best practices for Roll Up Summary Field here
Now let’s take an example and implement it step by step so that you become a Roll Up Genius 🙂
Please note that I have added links wherever needed in case you want to know more about…
Requirement:
User wants to display a sum of all WON opportunities on its associated account.
Solution STEP By STEP
- Create a custom field on the Account Object and Choose the Roll-Up Summary field type, and click Next.
- Now,Enter a label for the field and other attributes. Click Next.
- Now,Select the Opportunity object on the detail side of master-detail relationship. Opportunity Object contains here the Opportunity records you want to summarize.Then Select the type of summary-SUM.
- Enter your filter criteria – ‘Stage Equals Closed Won’.Try more filters to know how you can have any other selected group of records in your summary calculation. Click Next.
- Set the field-level security to determine whether the field should be visible for specific profiles, and click Next.
- Add the field to which all account page layout yo want to display and then click Save.
- Congrats!!! You have successfully implemented a requirement for Roll Up Summary Field.
What Next?
- Try out Roll Up Summary Field Trailhead Module (Earn the Badge 🙂 ) and Force.com Fundamentals example.
- Roll Up Summary on Look Up Field is not possible,However,Same can be achieved by using apex code.Jeff has explained it very well in this blog.Do not miss to read it.
- Do not miss to go through a similar blog from Jitendra Zaa
- Check out Declarative Roll Up Summary Tool