0% found this document useful (0 votes)
127 views

Report Formula Summary Functions: Parentgroupval and Prevgroupval

This document summarizes how to use summary functions in custom summary formulas in Salesforce reports to calculate relative values for groupings. The PARENTGROUPVAL function returns the value of a specified parent grouping, while the PREVGROUPVAL function returns the value of a specified previous grouping. Examples are provided to demonstrate calculating relative sizes compared to a grand total using PARENTGROUPVAL and calculating the difference between amounts of two months using PREVGROUPVAL.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

Report Formula Summary Functions: Parentgroupval and Prevgroupval

This document summarizes how to use summary functions in custom summary formulas in Salesforce reports to calculate relative values for groupings. The PARENTGROUPVAL function returns the value of a specified parent grouping, while the PREVGROUPVAL function returns the value of a specified previous grouping. Examples are provided to demonstrate calculating relative sizes compared to a grand total using PARENTGROUPVAL and calculating the difference between amounts of two months using PREVGROUPVAL.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

REPORT FORMULA SUMMARY FUNCTIONS

Summary Did you know that you can calculate relative values for groupings in reports? With summary functions in
custom summary formulas, you can!
Group values in report
formulas by using the
PARENTGROUPVAL and PARENTGROUPVAL and PREVGROUPVAL
PREVGROUPVAL summary
Use PARENTGROUPVAL to calculate values relative to a parent grouping. Use PREVGROUPVAL to
functions.
calculate values relative to a peer grouping.

PARENTGROUPVAL
Use this function to calculate values relative to a parent grouping.

Description: This function returns the value of a specified parent grouping. A “parent”
grouping is any level above the one containing the formula. You can use this
function only in custom summary formulas and at grouping levels for reports,
but not at summary levels.

Use: Summary and Joined: PARENTGROUPVAL(summary_field,


grouping_level)
Matrix: PARENTGROUPVAL(summary_field,
parent_row_grouping, parent_column_grouping)
Where summary_field is the summarized field value,
grouping_level is GRAND_SUMMARY or the API name of the parent
level group for summary reports, and parent_row_level and
parent_column_level are the parent levels for matrix reports.
In reports with multiple grouping levels, you can set the
grouping_level to be any group level higher than the formula display
level.

Example:
TOTAL_PRICE:SUM/PARENTGROUPVAL(TOTAL_PRICE:SUM,
GRAND_SUMMARY)

This formula calculates, for each product, its relative size compared to the
grand total. In this example, the report is a summary of opportunities and
their products, grouped by Product Name.

PREVGROUPVAL
Use this function to calculate values relative to a peer grouping. If there’s no previous grouping, the
function returns a null value.

Last updated: February 3, 2020


Report Formula Summary Functions Using Summary Functions

Description: This function returns the value of a specified previous grouping. A “previous”
grouping is one that comes before the current grouping in the report. Choose
the grouping level and increment. The increment is the number of columns
or rows before the current summary. The default is 1; the maximum is 12.
You can use this function only in custom summary formulas and at grouping
levels for reports, but not at summary levels.

Use:
PREVGROUPVAL(summary_field, grouping_level [,
increment])

Where summary_field is the name of the grouped row or column,


grouping_level is the API name of the peer level group whose
summary value for the previous grouping is used, and increment is the
number of groupings previous.
In reports with multiple grouping levels, you can specify the
grouping_level to be the same group level as the formula display
level or a group level higher than the formula display level.

Example:
AMOUNT:SUM - PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE)

This formula calculates, for each month, the difference in amount from the
previous month shown in the report. In this example, the report is an
opportunity matrix with columns grouped by Close Date and rows by
Stage.

Example: Three Week Moving Average


To calculate a three-week moving average of opportunity amounts:
(OppProductTrends__c.Amount__c:SUM+
PREVGROUPVAL(OppProductTrends__c.Amount__c:SUM,
OppProductTrends__c.as_of_date__c) +
PREVGROUPVAL(OppProductTrends__c.Amount__c:SUM,
OppProductTrends__c.as_of_date__c,2))/3

Using Summary Functions


1. Double-click Add Formula in the Fields pane.
2. In the Custom Summary Formula dialog, under Functions, select Summary.
3. Select PARENTGROUPVAL or PREVGROUPVAL.
4. Select the grouping level and click Insert.
5. Define the formula, including where to display the formula.
6. Click OK.
For more information, see “Evaluate Groups and Totals with Summary Formulas” and “Add a Summary
Formula Column to a Report” in the Salesforce online help.

You might also like