Sub topic 2
Preparing summary and matrix reports for dashboards
This chapter assumes you can create and run a basic report in Lightning Experience and know the standard objects Opportunities and Cases. It also assumes you know that a report is a saved query over one report type. You will learn which report formats can feed dashboard components and how to shape them so the components work.
Why the report format matters
A dashboard component does not query records itself. It reads the results of one source report. A component can show only what the report calculates: groupings and summary values such as record count, sum, or average.
A tabular report has no groupings. It can feed only a table component, or a metric limited to a single total. A summary or matrix report has groupings, so it can feed charts, gauges, and metrics.
| Format | Groupings | Typical component |
|---|---|---|
| Tabular | None | Table (top rows), single metric |
| Summary | Rows grouped by one or more fields | Bar, column, line, pie, donut, funnel, gauge, metric |
| Matrix | Rows and columns grouped | Stacked or grouped charts, comparisons across two dimensions |
Build a summary report for a chart
Suppose you want a chart of open pipeline by stage. Create an Opportunities report and apply these steps:
- Set the filter Closed to "Open" (or
IsClosed = false) and set a date range, such as Close Date = Current and Next FQ. - Switch the format to Summary.
- Group rows by Stage.
- Add a summary on Amount (Sum) and keep Record Count.
- Save the report in a folder that dashboard users can read.
The chart you build from it plots one bar per stage. The same totals as a SOQL query look like this:
SELECT StageName, SUM(Amount) total
FROM Opportunity
WHERE IsClosed = false
GROUP BY StageNameThe report gives the same numbers as this query. It also applies sharing rules for the running user, which a dashboard will use (covered in a later chapter).
Use a matrix for two dimensions
A matrix groups by rows and columns. For example, group rows by Stage and columns by Opportunity Owner's Region. When a chart is built from a matrix, the row grouping becomes the axis and the column grouping becomes the series, such as stacked segments in a bar.
Shape the report for the component
Most dashboard problems start in the report. These choices prevent them.
- Keep groupings few. Charts cap the number of groups they draw, and a chart with dozens of groups is unreadable. Filter or use a row limit to keep the top groups.
- Pick the summary field on purpose. If a report has several summaries, the component settings must name which one to plot. An unexpected default gives wrong numbers.
- Use report filters for the scope. A dashboard filter (later chapter) narrows an existing report. It does not replace a clear base filter.
- Name the report plainly, such as "Open Pipeline by Stage". Dashboard builders choose reports by name.
- Check the date filter. A report limited to "Current FQ" changes meaning as time passes, which is often what you want. A fixed range can silently go stale.
Common errors
- The source report cannot be chosen in the dashboard editor. The report is in a folder you cannot read, or the format has no groupings for the component you picked.
- A chart is empty. The filter returns no records for the running user, or the report has no grouping.
- A matrix chart looks wrong. The matrix has two groupings and the chart type expects one, so confirm the axis and series mapping.
Exercise
You need a dashboard chart that shows open Opportunity amount by Stage, split by Opportunity Owner's Region. Which report format should you use, and which groupings go on rows and columns?
Show answer
Use a matrix report. Group rows by Stage, which becomes the chart axis, and columns by region, which becomes the series. Add a Sum of Amount summary and filter to open opportunities.
Exercise
A teammate builds a dashboard chart from a tabular report and finds no chart options for grouped data. What is the cause and the fix?
Show answer
A tabular report has no groupings, so a chart has nothing to plot. Change the report to Summary format and group by the field you want on the axis.