---
schema_version: "1"
id: c435d58fc649718996f84df074389cf8395d9524ad34b08ea6ebe9ab134b30a1
title: Compare Groups with PARENTGROUPVAL() and PREVGROUPVAL()
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/analytics/264-0-0/reports_formulas_parentgroupval_prevgroupval.md
canonical_url: https://help.salesforce.com/s/articleView?id=analytics.reports_formulas_parentgroupval_prevgroupval.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 74a02ac700cedb4c2872008f9df70cc6df38673f22c35a2be3f42d662533e5e5
description: Write row level formulas to evaluate each record in a report. For example, see how many days it took each opportunity to close by subtracting the Open Date from the Close Date.
products:
  - Cross Cloud
release: "264"
---
# Compare Groups with `PARENTGROUPVAL()` and `PREVGROUPVAL()`

Write row level formulas to evaluate each record in a report. For example, see how many days it took each opportunity to close by subtracting the Open Date from the Close Date.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Salesforce Classic and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Essentials</strong>, <strong>Group</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Enhanced Folder Sharing</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="vertical-align:top;" id="d9104e93">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d9104e93 ">To create, edit, and delete formulas in private reports:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d9104e93 ">
              <dl>

                <dt style="font-weight:bold;padding-top:.25rem;">Enhanced Folder Sharing</dt>

                <dd style="padding-left:1.5rem;padding-bottom:.5rem;">Create and Customize Reports </dd>

              </dl>
            </td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d9104e93 ">To create, edit, and delete formulas in public and private reports:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d9104e93 ">
              <dl>

                <dt style="font-weight:bold;padding-top:.25rem;">Enhanced Folder Sharing</dt>

                <dd style="padding-left:1.5rem;padding-bottom:.5rem;">
                  <p style="margin-bottom:0;">Report Builder OR Report Builder (Lightning Experience)</p>
                </dd>

              </dl>
            </td>

          </tr>
        </tbody>
      </table>

- **[PARENTGROUPVAL and PREVGROUPVAL](https://help.salesforce.com/s/articleView?id=analytics.reports_summary_functions_about.htm&release=264.0.0&type=5)**  
    Use `PARENTGROUPVAL` to calculate values relative to a parent grouping. Use `PREVGROUPVAL` to calculate values relative to a peer grouping.
- **[Calculate Values Relative to a Parent or Peer Group](https://help.salesforce.com/s/articleView?id=analytics.reports_enhanced_summary_formulas.htm&release=264.0.0&type=5)**  
    You can add a formula that calculates values relative to a parent or peer grouping in a Lightning report. PARENTGROUPVAL calculates values relative to a parent grouping. PREVGROUPVAL calculates values relative to a peer grouping. For example, calculate the proportion of total opportunity amounts from each lead source, or compare sales each month to the previous month.