Formulas and Validations: Implement Roll-Up Summary Fields

Admin Intermediate > Formulas and Validations > Implement Roll-Up Summary Fields

Roll‑Up Summary Fields란?

Roll‑Up Summary Field(롤업 요약 필드)는 부모레코드에 자식레코드들의 데이터를 집계해서 자동으로 표시해 주는 필드입니다. 즉, 여러 자식 레코드의 값을 한 번에 계산해서 부모 레코드에 보여주는 기능이에요.
예를 들어:

  • 어떤 Account(계정) 레코드에 연결된 모든 기회(Opportunity)의 총 금액을 표시
  • 하나의 주문에 연결된 제품들의 수량 합계를 표시

언제 사용하나요?

Roll‑Up Summary는 다음처럼 관련 레코드들에 대한 요약값이 필요할 때 사용해요:

  • 자식 레코드의 총합 (SUM)
  • 자식 레코드의 갯수 (COUNT)
  • 자식 레코드의 최소값 (MIN)
  • 자식 레코드의 최대값 (MAX)

예:

  • 한 계정이 가진 기회 수
  • 한 주문이 가진 제품들의 가격 총합
  • 특정 날짜 중 가장 빠른/늦은 날짜
    … 등을 한 번에 보여줄 수 있습니다.

Roll‑Up Summary는 어떤 관계에서만 가능한가?

Roll‑Up Summary는 Master‑Detail 관계에서만 사용할 수 있어요.
즉, 부모와 자식 레코드가 단단히 연결되어 있어야 합니다. Lookup 관계에서는 기본 Roll‑Up Summary를 만들 수 없습니다.

사용 가능한 계산 유형

유형설명
COUNT자식 레코드 개수 세기
SUM지정 필드 값의 합계
MIN지정 필드 중 가장 작은 값
MAX지정 필드 중 가장 큰 값

SUM은 숫자/통화/퍼센트 등만 가능하고
MIN/MAX는 숫자/통화/날짜/시간 등에서도 사용할 수 있어요.

Roll‑Up Summary 필드 만드는 법

  1. Setup > Object Manager > Account > Fields & Relationships > New
    • Data Type: Roll-Up Summary
    • Field Label: Sum of Opportunities
    • Summarized Object: Opportunities
      * 요약할 타겟입니다.
    • Roll-Up Type: Sum
    • Field to Aggregate: Amount
  2. Next, Next, Save

Sales > Accounts에서 레코드를 하나 찍고 들어가면 Deatils필드들 중간에 Sum of Opportunities필드가 추가된걸 확인하실 수 있습니다.

더 많은 예제

자식 날짜 중 가장 이른 날짜 보기

  • 부모: Account
  • 자식: Opportunity
  • Roll‑Up Type: MIN
  • Field to Aggregate: Created Date

Account에 연결된 가장 빠른 기회 생성일 표시하여 기회가 처음 생성된 날짜를 알려줍니다.

제품 가격 총합 보기

  • 부모: Opportunity
  • 자식: Opportunity Product
  • Roll‑Up Type: SUM
  • Field to Aggregate: Total Price

기회에 포함된 모든 제품 가격 총합을 보여줍니다.

기회의 최소 정가

  • 부모: Opportunity
  • 자식: Opportunity Product
  • Roll‑Up Type: MIN
  • Field to Aggregate: Total Price

기회에 포함된 제품중 가장 최소금액을 보여줍니다.

제한사항

  • Lookup 관계에서는 기본 Roll‑Up Summary 사용 불가
  • AVERAGE 기능은 표준으로 없음
  • 아주 복잡한 조건이나 비표준 집계는 Flow, Apex 또는 DLRS 같은 도구 사용해야 함

Hands-on Challenge

Create a Rollup Summary Field

Add a custom field to the standard account object to provide a rollup summary of the total expected revenue from all related opportunities.

Important: If you have Advanced Currency Management enabled in your Trailhead Playground, disable it for this Hands-On Challenge.

  • Create a roll-up summary field on the Account object:
    • Field Label: Potential Value
    • Field Name: Potential_Value
    • Calculate the total expected revenue of all the opportunities related to the account

풀이

Account와 관련된 모든 Opportunities의 총 expected revenue 계산하기

  1. Setup > Object Manager > Account > Fields & Relationships > New
    • Data Type: Roll-Up Summary
    • Field Label: Potential Value
  2. Step 3. Define the summary calculation
    • Summarized Object: Opportunities
    • Roll-Up Type: SUM
    • Field to Aggregate: Expected Revenue
  3. Next, Next, Save