Sub topic 3
Custom Summary Formulas and Advanced Report Formats
Assume you can create Salesforce reports and understand objects, fields, groupings, and filters. This chapter shows how to extend grouped reports, combine report blocks, and choose a format for a business question.
Custom summary formulas
A custom summary formula calculates a value from summarized report data. For example, in a grouped Opportunity report, this formula calculates the average Amount per record:
AMOUNT:SUM / RowCountTo compare the current group with the previous group, use PREVGROUPVAL. This example compares summed Amount by Close Date:
AMOUNT:SUM - PREVGROUPVAL(AMOUNT:SUM, CLOSE_DATE)The available grouping names and summary functions depend on the report. Check the formula editor for valid field and grouping references.
Joined reports and common groupings
A joined report combines multiple blocks. Each block can use a different report type, such as Accounts with Opportunities and Cases. Use blocks when one report needs related but differently scoped views.
Common groupings connect blocks through the same field, such as Account Name. Salesforce can then place each block's results beside the matching group. This enables cross-block comparisons, but only when the grouping values match. Differences in spelling, blank values, or field meaning can produce misleading comparisons.
Charts, dashboards, and format choices
Summary and matrix reports usually provide the groupings needed for charts and dashboard components. Tabular reports are useful for detailed lists, but they offer limited grouping for visual summaries. Joined reports can support charts, although a chart may represent one block or a selected combined view rather than every relationship clearly.
Choose the format from the question:
- Use tabular for a record list or export.
- Use summary for totals by one dimension.
- Use matrix for comparisons across two dimensions.
- Use joined for several perspectives with different report types.
Reports and SOQL aggregates
A summary report often resembles a SOQL aggregate query:
SELECT StageName, SUM(Amount) total, COUNT(Id) cnt
FROM Opportunity
GROUP BY StageNameA matrix report resembles a query grouped by two dimensions:
SELECT StageName, CALENDAR_YEAR(CloseDate) yr, SUM(Amount) total
FROM Opportunity
GROUP BY StageName, CALENDAR_YEAR(CloseDate)Reports add declarative filters, formulas, security behavior, and presentation. SOQL provides query control but does not directly reproduce every report feature, especially joined blocks and report-specific formulas.
Exercise
Which format should you use to compare Opportunity Amount by Stage and Close Year?
Show answer
Use a matrix report because it groups records by rows and columns.