Sub topic 4
Chart, gauge, metric and table components
This chapter assumes you can create and run a summary report in Lightning Experience, and that you know what a dashboard is and how to open the dashboard editor. It covers the four component types you place on a dashboard, how each one reads from a report, and the errors people hit most often when they pick the wrong one.
What a component is
A dashboard component is a visual built from one source report. Each component has its own source report, its own display type, and its own settings. A dashboard holds up to 20 components, and several components can use the same report.
A component does not store data. When the dashboard refreshes, Salesforce reruns the source report as the running user. It then draws the result in the format you chose. If a component looks wrong, the cause is usually in the report, not in the component.
The four families of component are:
- Chart: compares groups of values visually.
- Gauge: shows one value against a target range.
- Metric: shows one number with a label.
- Table: lists the top rows of a report.
How components read a report
What a report can feed depends on its format.
| Component | Report format needed | What it reads |
|---|---|---|
| Chart | Summary or matrix, or a tabular report with a row limit | Groupings and one summary value |
| Gauge | Summary or matrix | One summary value |
| Metric | Summary or matrix (or tabular for a record count) | One summary value, or the record count |
| Table | Summary, matrix, or tabular | Grouping values and a summary value, or up to 200 rows |
The central rule is that a chart, gauge, or metric needs something to summarize. If the source report is summary, the dashboard can plot a grouping on the axis and a summary field as the value. If the report is a matrix, it can use both a row grouping and a column grouping. A tabular report has no groupings, so it supports only a limited set of uses, and you must set a row limit before a chart can use it.
Chart components
A chart compares values across groups. The chart type you can choose depends on the report's groupings.
The main chart types are:
- Bar charts (horizontal) and column charts (vertical). Both compare values across categories. Stacked and grouped variants show a second grouping.
- Line charts. These show a value over an ordered axis, most often time.
- Pie, donut and funnel charts. These show parts of a whole, or stages that narrow down.
- Scatter charts. These plot two summary values against each other.
A summary report with one grouping gives the simplest chart: one bar per group value. Take the open pipeline example. A report on Opportunities with the filter "Closed = False", grouped by Stage and summing Amount, produces one bar per stage. The SOQL below returns the same grouped totals the chart would draw.
SELECT StageName, SUM(Amount) total
FROM Opportunity
WHERE IsClosed = false
GROUP BY StageNameIf you add a second grouping to the report, such as Owner, you can use a stacked column chart. Each stage becomes a column, and each owner becomes a segment inside it. A report with three or more groupings can only use the first two on a chart.
Choosing the chart type is a design decision that is covered in a later chapter. For this chapter, keep one point in mind: a chart can only show what the report groups. If the chart you want needs a grouping, add it to the report first.
Chart settings you will change often
In the component editor, these settings affect the result most:
- Y-axis value. Choose Record Count or one of the summary fields in the report. If you pick a summary field that the report does not have, add it to the report first.
- X-axis grouping. Choose which report grouping runs along the axis.
- Sort rows by. Sort by label, or by value. Sorting by value helps when readers want a ranking.
- Max groups displayed. Limit the chart to the top groups, so a long tail does not crowd the axis.
- Display units. Show full numbers, thousands, millions, or similar. Shorter units keep labels readable.
Gauge components
A gauge shows one summary value on a dial, and you define what counts as low, middle, and high. Use a gauge when the reader needs to know "are we on track?" more than "what is the breakdown?"
A gauge needs:
- A source report with a summary value, such as the sum of Amount on closed-won Opportunities this quarter.
- A minimum value for the dial.
- A breakpoint between the first and second range.
- A breakpoint between the second and third range.
- A maximum value for the dial.
Salesforce colors the three ranges red, yellow, and green by default, and you can change the colors. The breakpoints are fixed numbers you type in. They do not update on their own. If your quarterly target changes, you must edit the gauge.
Metric components
A metric shows a single number with a label. It is the smallest component and is good for headline figures such as "Open Cases" or "Total Pipeline."
A metric reads one summary value from a report. You can add a title and a label that describes the number. For summary and matrix reports, you can also set up to a few goal-based color ranges so the number changes color when it crosses a threshold. This is a lightweight alternative to a gauge when you do not need the dial.
You can also stack several metrics in a single column. In Lightning Experience, the metric component allows more than one metric inside the same component, each from a different summary field of the same report. This keeps related numbers together and saves space.
Use a metric when:
- The reader needs one number and a label.
- You want a clean row of headline figures across the top of the dashboard.
- A chart would add nothing, such as a total with no breakdown.
Table components
A table lists values in rows. It is the only component that can show record-level detail, up to a point.
Tables read from a report in two ways:
- From a summary or matrix report, a table shows the groupings and the summary value, ranked by value or by label.
- From a tabular report, a table shows the report's columns. It shows at most the first 200 rows, and the report's own sort and row limit decide which rows those are.
A table can show up to 10 rows per column group by default, and you can choose which columns to display and which to sort by. Rows that hold records link to the record, and the group names link to the source report.
Tables suit lists that need action, such as "Top 10 open opportunities by amount." They suit them better than charts because the reader can click through to a record. They are weaker for comparison, because the eye cannot compare numbers in a column as quickly as it compares bar lengths.
Choosing between the four
Ask what the reader needs to do with the data.
| Reader's question | Best component |
|---|---|
| How does this compare across groups? | Chart |
| Are we on target? | Gauge |
| What is the number? | Metric |
| Which records need attention? | Table |
You can also mix them. A common layout puts metrics across the top, one or two charts in the middle, and a table at the bottom. The later chapter on design practices covers layout. The chapter on filters shows how one filter can narrow all of these components at once.
Common errors
These problems appear often when people first add components.
- The component is empty. The running user may not have access to the source report's records or folder, or the report filters match no rows. Run the report yourself as the running user, or check the report's filters.
- The chart type you want is not offered. The report does not have the groupings that chart type needs. Add a grouping to the report, or switch to a type that fits the current groupings.
- The numbers differ from the report. The component shows a rounded or scaled value because of the display units setting. It may also show a limited number of groups because of the max groups setting.
- The report you want is missing from the list. The report is in a folder you cannot see, or it has the wrong format for the component. Check the folder access and the report format.
- A gauge always shows the same color. The breakpoints do not match the scale of the data. Check that the minimum, breakpoints, and maximum cover the real range.
- The table shows fewer rows than the report. Tables cap the number of rows. Open the source report to see the full list.
Exercises
Exercise
A tabular report lists all open Cases with columns for Case Number, Priority and Owner. You try to add a column chart from it and the grouping options are limited. What should you change in the report to give the chart a meaningful axis, and what is the result?
Show answer
Convert the report to a summary report and group it by Priority (or Owner). The chart can then plot Priority on the axis with the record count as the value. Without a grouping, the report has nothing to summarize by category, so the chart has no axis to draw.
Exercise
Your sales director wants one dial that shows whether closed-won amount this quarter is on track against a 1,000,000 target, with red below 400,000 and green above 800,000. Which component do you use, and what values do you set for minimum, the two breakpoints, and maximum?
Show answer
Use a gauge. Set the minimum to 0, the first breakpoint to 400,000, the second breakpoint to 800,000, and the maximum to 1,000,000. The source report should be a summary report that sums Amount on closed-won Opportunities for the current quarter.
Exercise
A table component built from a summary report lists top accounts, but readers say they cannot click through to the individual Opportunities. Why, and which component or report format would let them reach records?
Show answer
A table built from a summary report shows groupings and summary values, so its rows are groups and link to the source report. To show record-level rows that link to records, build the table from a tabular report. The table then lists the report's columns, up to its row cap.