What is a Roll-up Summary field in Salesforce?

Definition

A Roll-up Summary field in Salesforce is a calculated field on a master object that summarizes data from a set of related detail (child) records in a master-detail relationship. It performs aggregate calculations such as SUM, MIN, MAX, and COUNT across child records and saves the result on the parent record.

How it works

Roll-up Summary fields operate on master-detail relationships only. When child records are created, updated, or deleted, Salesforce automatically recalculates the roll-up summary value and stores it on the parent (master) record. You can also apply filter criteria to include only child records that meet specific conditions.

Common use cases

  • Summing Opportunity Amounts on an Account (e.g., Total value of related Opportunities)
  • Counting the number of closed Cases on an Account
  • Finding the most recent date among related records using MAX
  • Summing quantities from related OpportunityLineItems on an Opportunity

Example (declarative)

Suppose you want to show the total amount of all Closed Won Opportunities on an Account. Create a Roll-up Summary field on Account:

Account.Total_ClosedWon_Oppty_Amount__c = SUM(Opportunity.Amount WHERE StageName = 'Closed Won')

Available roll-up operations

  • SUM — Adds numeric values from child records.
  • MIN — Returns the smallest value.
  • MAX — Returns the largest value.
  • COUNT — Counts the number of child records that match the criteria.

Limitations and considerations

  • Master-detail only: Roll-up Summary fields require a master-detail relationship. They are not supported on lookup relationships unless converted to master-detail or implemented with Apex/Flow/DLRS.
  • Per-object limits: There is a limit on the number of roll-up summary fields per object (commonly 25 by default — check your org limits).
  • Filtering: You can add simple filter criteria on child fields, but complex cross-object filters are not supported.
  • Recalculation & order of execution: Roll-ups recalculate during record save and can affect triggers, workflows, and flows. Take care with recursive updates and governor limits.
  • Not editable: The roll-up field value is system-calculated and cannot be directly edited.

Alternatives when limitations apply

If you cannot use a roll-up summary (e.g., the relationship is a lookup or you need more complex logic), consider:

  • Apex triggers or batch Apex for custom aggregation logic.
  • Salesforce Flow (Record-Triggered Flow) to calculate and update the parent record.
  • Declarative Lookup Rollup Summaries (DLRS) — a community tool that provides roll-up capabilities for lookup relationships.

Best practices

  • Use declarative roll-ups where possible for performance and maintainability.
  • Minimize the number of roll-up summary fields on a single object to avoid hitting org limits.
  • Document any custom roll-up logic implemented with Apex or Flow to avoid surprises in future maintenance.
  • Test order-of-execution interactions (triggers, workflows, process builders/flows) when roll-ups are involved.

Quick reference: sample configuration


Parent Object: Account
Child Object: Opportunity (master-detail to Account)
Roll-up Type: SUM
Child Field: Amount
Filter Criteria: StageName = 'Closed Won'
Result Field: Account.Total_ClosedWon_Oppty_Amount__c

Roll-up Summary fields are a powerful declarative tool in Salesforce for summarizing child record data on the parent. Use them when the relationship and aggregation needs align with Salesforce’s native capabilities — otherwise opt for custom or community solutions.