Sub topic 2
Preparing Summary and Matrix Reports for Dashboards
This chapter assumes you can create and run a basic report in Lightning Experience, know the standard objects (Accounts, Opportunities, Cases), and understand that profiles, roles, and sharing control which records a person can see. It builds on the previous chapter, where reports were introduced as the data source for every dashboard component.
A dashboard component does not query records directly. It reads the output of a source report. If the report is shaped badly, no component setting can fix it. This chapter covers how to shape summary and matrix reports so they feed charts, gauges, metrics, and tables cleanly.
Why report format matters
Salesforce offers four report formats: tabular, summary, matrix, and joined. Dashboards treat them differently.
| Format | Groupings | Can feed a chart or gauge? | Notes |
|---|---|---|---|
| Tabular | None | Only as a table or metric using a record count, and only with a row limit | No groupings to plot |
| Summary | One to three row groupings | Yes | Most common source |
| Matrix | Row and column groupings | Yes | Allows two-dimensional charts, such as stacked bars |
| Joined | Groupings per block | Limited | Only some component types work with it |
The rule to remember is that charts need groupings. A grouping is a field you use to bucket records, such as Stage, Owner, or Close Month. The chart draws one data point per group value, and the value of each point is a summary of the records in that group.
Summary reports
A summary report lists records and groups them by one to three fields. Each group shows subtotals, such as a record count, a sum, an average, a minimum, or a maximum of a numeric field.
Suppose you want a dashboard that shows open pipeline by stage. The report setup is:
- Report type: Opportunities.
- Filters: Show All Opportunities, and Closed = False.
- Group rows by: Stage.
- Summarize: Sum of Amount.
This report corresponds to the following SOQL query. You do not run SOQL to build a dashboard, but reading the report this way makes clear what the chart will receive.
SELECT StageName, SUM(Amount) total
FROM Opportunity
WHERE IsClosed = false
GROUP BY StageNameEach row of the result becomes one bar or slice. If you add a second grouping, such as Owner, the report adds a nested level, and the dashboard can use the groupings for stacked or grouped charts.
Choosing the summary field
The value a component plots is one of the report's summary fields. A summary report always has Record Count. You can also add summaries such as Sum of Amount or Average of Amount. When you build the component, you pick which of these to plot.
- Add every summary you might want on the dashboard before you start building. Changing the report later affects every component that uses it.
- Keep the number of summary fields small. A report with ten summaries makes the component's value picker harder to use.
- Use a custom summary formula when the number you need is a ratio, such as win rate. A custom summary formula is a calculated field at the grouping level. It is available to components as a plottable value.
Limits on groupings
A summary report allows up to three row groupings. A chart component can use only the first grouping in a simple chart. For stacked charts, it uses the first two. The third grouping is ignored by charts, although a table component can show it. If a chart seems to show less detail than your report, check which groupings the chart type supports.
Matrix reports
A matrix report groups by both rows and columns. It is useful when you need to compare two dimensions, such as stage by owner, or cases by priority and status.
For example, a matrix of open opportunities:
- Row grouping: Stage.
- Column grouping: Opportunity Owner.
- Summary: Sum of Amount.
The grid cells hold the sum for each stage and owner pair. A dashboard can read this as a stacked bar chart. Each bar is a stage, and each segment of the bar is an owner.
A matrix can have up to two row groupings and two column groupings. Charts use these as follows:
- One row grouping and no column grouping behaves like a summary report. It gives a simple chart.
- One row grouping and one column grouping gives a stacked or grouped chart.
- Two row groupings or two column groupings give a deeper breakdown, and only some chart types show both levels.
Summary versus matrix: how to choose
Use a summary report when one grouping answers the question, or when you want several separate components from the same report. Use a matrix when the question is about the interaction of two dimensions.
| Question | Better format | Reason |
|---|---|---|
| How much open pipeline is in each stage? | Summary | One grouping |
| Which owner has what pipeline in each stage? | Matrix | Two groupings |
| How many cases are open? | Summary or tabular | A single count |
| Cases by priority and status? | Matrix | Two groupings |
| Top 10 accounts by revenue | Summary with a row limit | Grouped by account, sorted and limited |
A matrix is not always better. It has fewer options for sorting and row limits, and a matrix with many column values makes a crowded stacked chart. If a chart has more than five or six segments per bar, readers cannot compare them.
Prepare the report before you build the dashboard
Work through these steps in the report builder, in this order.
- Set the filters first. Decide the time frame, ownership scope, and status. For example, use Close Date = THIS FISCAL QUARTER rather than a fixed date range, so the dashboard stays current without edits.
- Choose the grouping fields. Group by a field with a manageable number of distinct values. Grouping by Account Name on a large org produces hundreds of groups. A chart cannot show them all.
- Add summary fields. Add the sums, averages, and counts the dashboard will use.
- Sort and limit. For ranking charts, sort the groupings by the summary value, and apply a row limit where the format allows it.
- Name and place the report. Give the report a clear name and save it in a folder that the dashboard's viewers can access.
- Run the report as a check. Confirm that the totals look right for the data you know.
Date groupings and buckets
Time-based charts use a date grouping. In the report builder, group by a date field and choose the granularity: Day, Week, Month, Calendar Quarter, Fiscal Quarter, Year, and so on. Pick the granularity that matches how the dashboard will be read. Monthly pipeline needs Month, not Day.
A bucket field lets you create groups without a custom field. For example, you can bucket Amount into Small, Medium, and Large, or bucket many Lead Source values into three categories. Buckets are defined inside the report, so they are available for that report only. They are useful, but a field that many reports need should be a real field or a formula field.
Date groupings can have empty periods. If no record exists for a month, that month does not appear unless you turn on the option to show empty date groups, which some report types support. Without it, a line chart can connect two months and hide a gap.
Common errors
- Blank chart. The source report has no groupings, or the filters return no records. Open the report and check.
- Wrong total. The component plots Record Count when you wanted Sum of Amount. Check the Y-axis value in the component.
- Report not found in the editor. The report is in a folder you cannot access, or it was deleted.
- A column grouping is missing from the chart. A summary report has no column grouping. Use a matrix for two-dimensional charts.
- More than 2,000 rows. A report shows at most 2,000 rows in a table or tabular output. Group, filter, or limit to avoid truncated detail. Groupings and summaries still calculate across all matching records.
- Report type changed. If you change the report type, fields can disappear and the dashboard can break.
Example: a report ready for a dashboard
A sales manager wants a dashboard with three components: pipeline by stage (chart), total open pipeline (metric), and the top ten open deals (table). One summary report can feed the first two. The table can use the same report with a row limit, or a separate tabular report.
Report: "Open Pipeline by Stage"
- Format: Summary.
- Filters: Closed = False, Close Date = THIS FISCAL YEAR.
- Group rows by: Stage.
- Summaries: Record Count, Sum of Amount.
The chart plots Sum of Amount by Stage. The metric uses the grand total of Sum of Amount. You build the whole dashboard from one report, so a later filter change to the report updates both components.
Exercise
A manager wants a stacked bar chart that shows open case counts for each Priority, split by Status. Which report format do you use, and which fields go in which grouping?
Show answer
Use a matrix report on the Cases report type, filtered to open cases. Group rows by Priority and group columns by Status, and summarize by Record Count. The chart then draws one bar per priority, with one segment per status.
Exercise
A chart on your dashboard shows only five of the seven stages in your report. The report itself shows all seven. Name two things to check.
Show answer
Check whether the component has a limit on the number of groups displayed, and whether the component's own filter or the dashboard filter excludes the missing stages. Also confirm that the component points at the report you expect and not a copy with different filters.