Sub topic 3
Creating your first dashboard
A dashboard is a page of visual components. Each component reads from one source report and shows that report's data as a chart, gauge, metric, or table. This chapter covers the anatomy of a dashboard, how to build one in the Lightning dashboard editor, and the settings that decide what viewers see.
Prerequisites
This chapter assumes you can do the following:
- Navigate Lightning Experience and open the Reports and Dashboards tabs.
- Create and run a summary report on Opportunities or Cases.
- Explain at a basic level how profiles, roles, and record sharing limit which records a user can see.
The previous chapter prepared summary and matrix reports. This chapter uses them as sources. The next chapter covers each component type in detail, so here you only need one of each to get started.
How a dashboard is put together
A dashboard has three layers.
- Source reports. Every component points to exactly one report. The report holds the filters, groupings, and summary fields. The dashboard does not store data of its own.
- Components. Each component is a visual layout on top of a report. Several components can share the same report.
- Dashboard settings. These include the title, folder, running user, and dashboard filters. They apply to every component.
Because of this structure, a dashboard is only as good as its reports. If a component shows the wrong number, the cause is usually in the report's filters or groupings, not in the dashboard.
The running user in the diagram is the key setting. When a dashboard refreshes, Salesforce runs each source report as that user. The viewer sees the result of that run, even if the viewer could not see those records themselves. Later chapters cover this in depth. For now, remember that the running user sets the data, and folder access sets who can open the dashboard.
Reports that work well as sources
A component can only show what its report provides. Check these points before you build.
- Summary or matrix format. Charts need at least one grouping. A tabular report works only for a table component, and only with a row limit.
- Useful groupings. A chart groups by the report's first grouping. A matrix report can feed stacked or grouped charts because it has two groupings.
- A summary value. Choose a field such as record count, sum of Amount, or average of Age. Components display summaries, not individual field values.
- A stable filter. Use relative date ranges such as "Current FQ" so the dashboard stays current without edits.
The first example query in this tutorial shows the shape of data a chart component needs. A report of open opportunities grouped by stage returns the same totals as this SOQL:
SELECT StageName, SUM(Amount) total
FROM Opportunity
WHERE IsClosed = false
GROUP BY StageNameEach row becomes one bar, one slice, or one point. The stage is the grouping, and total is the summary value.
Build the dashboard
These steps use Lightning Experience. Create a report named "Open Pipeline by Stage" first. It should be a summary report on Opportunities, filtered to open opportunities and grouped by Stage, with Sum of Amount as the summary.
- Open the Dashboards tab and click New Dashboard.
- Enter a name, such as
Sales Pipeline Overview. Salesforce fills in a unique name for the API. Pick the folder where the dashboard will live. If you have no folder, create one from this dialog. - Click Create. The dashboard editor opens with an empty canvas.
- Click + Component. Search for "Open Pipeline by Stage" and select it.
- Choose a component type, such as a vertical bar chart. Set the Display Units, Axis, and Title in the right panel.
- Click Add. The component appears on the canvas.
- Click Save, then Done. Salesforce opens the dashboard and shows the data as of the last refresh.
The editor shows a preview as you work. This preview uses the running user's data and may be a few minutes old. Press Refresh after saving to confirm that numbers match the report.
Anatomy of the editor
The editor has three areas.
| Area | What it does |
|---|---|
| Canvas | Holds the components. Drag to move them and drag the corners to resize them. |
| Component panel | Appears when you select a component. Controls the report, type, grouping, and display options. |
| Properties | Opens from the gear icon. Controls the title, running user, theme, and the dashboard filters. |
Lightning dashboards use a grid with up to three columns on most layouts. You can set the column width and each component's height. Plan the layout before you add many components. Resizing later is easy, but reordering a full dashboard takes more drag steps.
Set the running user
Open Properties and find View dashboard as. Three choices are possible, and which ones appear depends on your edition and permissions.
- Me. The dashboard runs as you. Your own access to records decides the data. This is the default for a new dashboard.
- Specific user. The dashboard runs as a chosen person. Every viewer sees that person's data. Use this for shared team views, such as a company-wide pipeline. It needs the "Manage Dynamic Dashboards" permission for users other than yourself, in orgs where that rule applies.
- The dashboard viewer. The dashboard is dynamic. Each viewer sees the data they can access. This option is covered in the dynamic dashboards chapter.
Pick the running user on purpose. A common first mistake is leaving the setting as yourself, then sharing the dashboard with a team. Viewers then see your records, which may be a different set from theirs. If you leave the company or are deactivated, the dashboard cannot refresh until someone changes the running user.
Save the dashboard in a folder
The folder controls who can open and edit the dashboard. It does not decide which records appear. These two settings are independent.
- A user needs access to the dashboard's folder to see the dashboard.
- Source reports sit in their own folders. A viewer does not need access to the source report folder to see the component.
- A user who wants to click through to the report must have access to that report's folder.
This is why a person can sometimes open a dashboard and see charts, but get an "insufficient privileges" message when they click a component. The dashboard folder was shared with them, but the report folder was not.
Check what you built
After saving, run these quick checks.
- Compare one component's total with the source report. They should match, apart from the time of the last refresh.
- Open the dashboard as another user if you have a test account. Confirm the data is what you expect for the running user setting.
- Open the dashboard properties and check the title, folder, and running user.
You can also inspect the dashboard from SOQL. The Dashboard object stores the title, folder, and running user type. This query shows the basics for dashboards that run as the viewer:
SELECT Id, Title, DeveloperName, FolderName, Type, RunningUserId
FROM Dashboard
WHERE Type = 'LoggedInUser'A dashboard you just created with a specific running user returns no rows for this query, because its Type is SpecifiedUser. This is expected. Use this check again after you build the dynamic dashboard later in the tutorial.
Common first-dashboard problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Component says "No data" | The report has no rows for the running user, or the filter excludes all records | Run the report as that user and relax its filters |
| Chart has one bar called "All" | The report has no grouping | Add a grouping to the report and reselect it in the component |
| Totals differ from the report | The dashboard was not refreshed since the data changed | Click **Refresh**, then compare again |
| Viewer cannot find the dashboard | The folder is not shared with the viewer | Share the folder, not each dashboard |
| Component shows data for the wrong team | The running user is you, not the viewer | Change the running user or make the dashboard dynamic |
Summary
A dashboard stores layout, not data. Each component reads one source report, and the running user decides which records that report returns. The folder decides who can open the dashboard. Build the report first, add one component at a time, and set the running user deliberately before you share.
Exercise
You build a dashboard that runs as you and share its folder with the sales team. A team member opens it and says the numbers are not their own opportunities. What setting caused this, and what are two ways to fix it?
Show answer
The running user is set to you, so every viewer sees the data you can access. One fix is to change the running user to a specific user whose access fits the whole audience, which gives everyone the same shared view. The other is to make the dashboard dynamic by running it as the dashboard viewer, so each person sees their own data.
Exercise
A viewer can open a dashboard and see charts, but gets an insufficient privileges message when clicking a component to view the report. What is the most likely cause?
Show answer
The viewer has access to the dashboard's folder but not to the folder that holds the source report. Sharing the report folder with the viewer fixes it. The dashboard still displays data because it runs the report as the running user.