Working with Dashboards and Visualizations · Topic 1 of 2
Building AI/BI Dashboards and Visualizations
Databricks Data Analyst: AI/BI Dashboard pages, datasets and widgets, visualizations in notebooks and SQL editor, query parameters and picking chart types.
- 5 min
- Datasets live on the Data tab; widgets on canvas pages read from them.
- Dashboards support multiple pages, multiple datasets, and visualization, text and filter widgets.
- In the SQL editor or a notebook, click + above results, then Visualization.
What it is
An AI/BI Dashboard is the Databricks dashboard for sharing insights. It has a Data tab, where you define datasets from Unity Catalog tables, views or SQL queries, and a canvas of one or more pages, where widgets display those datasets.
Quick charts can also be made straight from a result in a notebook or the SQL editor. Parameters let readers change the values a query uses, such as a date range or region, without editing SQL.
How it works
Datasets
Each dataset is a table, a view or a custom SQL query, added on the Data tab, for example with Add SQL dataset. A dashboard can hold several datasets from different tables, and each visualization reads from one dataset.
Put joins and heavy logic in the dataset query or in a view, then point several widgets at the same dataset. That keeps the canvas simple and lets widgets share results.
Pages and widgets
A dashboard can have multiple pages, shown as tabs; add one with the plus icon next to the current page title. Use pages to separate audiences or subjects, such as a summary page and a detail page.
| Widget | Use |
|---|---|
| Visualization | A chart, counter or table built from a dataset |
| Text box | Titles, notes and links in Markdown; images go in with Markdown image syntax |
| Filter | Lets readers filter by a field or set a parameter |
Add widgets from the toolbar at the bottom of the canvas. Filters can apply to the whole dashboard, one page or one widget, and clicking a value in one chart can cross filter the others.
Visualizations in notebooks and the SQL editor
Run a query, click + above the result and choose Visualization. Pick the Visualization Type, choose the columns to plot and click Save; the chart appears as a tab beside the results.
In a notebook, any SQL cell result, or display(df) in Python, gives the same option. From the tab menu, Add to dashboard sends a chart from the SQL editor or a notebook SQL cell to an existing or new AI/BI dashboard.
Parameters in queries
A named parameter marker is a colon and a name. It works in the SQL editor, notebooks, the dashboard dataset editor and Genie Agents.
SELECT region, SUM(amount) AS sales
FROM main.sales.orders
WHERE order_date BETWEEN :dates.min AND :dates.max
AND region = :region
GROUP BY region;
Typing the marker adds a parameter widget where you set the type and a value. Types include String, numeric, Date and Date and Time (timestamp); the date types support a Range read with .min and .max. String values are quoted and escaped for you, so do not add quotation marks around the marker.
Use IDENTIFIER(:tbl) when the parameter names a table or column rather than a value.
Parameters in dashboards
On the Data tab, click Add parameter or type the marker. The gear icon opens Parameter details to set the display name and type, and the field under the name holds the default value.
Test by running the dataset query on the Data tab: the run uses the default value and confirms the query works. Then add a filter widget on the canvas and add the parameter under Parameters in its settings.
For a multi value pick list, select Allow multiple selections and change the query so it handles a list and an empty selection.
WHERE ARRAY_CONTAINS(:region, region) OR :region IS NULL
| Parameter | Field filter | |
|---|---|---|
| Acts on | The SQL text before it runs | The dataset's fields |
| Cascading | No | Yes, by default |
| Best for | Values the query needs, such as a date in a subquery | Slicing a dataset by a column |
A default set in the filter widget overrides the default set in the dataset editor.
Choosing a visualization type
| Insight | Effective chart |
|---|---|
| Trend over time | Line or area chart |
| Compare categories | Bar chart, sorted |
| Part of a whole, few categories | Pie chart, or a stacked bar |
| Relationship between two measures | Scatter plot |
| Distribution of one measure | Histogram or box plot |
| One headline number against a target | Counter |
| Two dimensions with intensity | Heatmap |
| Geographic values | Map |
| Exact values to look up | Table or pivot table |
Pie charts become hard to read with many slices, and a bar chart sorted by value compares categories more clearly.
How the exam asks about this
- "Show monthly revenue across two years so the trend is clear." A line chart with month on the x axis.
- "Let readers pick a date range that is used inside a subquery." A date range parameter with
.minand.max, connected to a filter widget. - "Add a company logo and a short explanation to the dashboard." A text box widget with Markdown, including an image.
What to remember for the exam
- Datasets live on the Data tab; widgets on canvas pages read from them.
- Dashboards support multiple pages, multiple datasets, and visualization, text and filter widgets.
- In the SQL editor or a notebook, click + above results, then Visualization.
- Named parameters use
:name; date ranges use:name.minand:name.max. - Test a dashboard parameter by running the dataset with its default value.
- Line for trends, bar for comparisons, scatter for relationships, counter for one KPI.
Turning on Allow multiple selections without changing the query to use ARRAY_CONTAINS causes an error. The query must accept a list, and an IS NULL check keeps "all values" working.
Common mistakes
Using a parameter where a field filter fits. Parameters rewrite the SQL and do not cascade. For simple slicing by a column, a field filter is easier and often faster.
Building one huge dataset per widget. Duplicated queries cost more to run and drift apart. Share a dataset across widgets.
Choosing a pie chart for many categories. Thin slices are hard to compare. Use a sorted bar chart.
Check yourself
How do you add a chart to a SQL editor result?
Click the plus icon above the results, choose Visualization, pick the visualization type and columns, and save it as a tab.
How is a date range parameter referenced in SQL?
With the parameter's min and max fields, for example BETWEEN :dates.min AND :dates.max, using a Date or Timestamp type with the Range widget.
Which chart best shows how two numeric measures relate?
A scatter plot, which places each record by both measures so a correlation or cluster is visible.
Topic 1 of 2 in Working with Dashboards and Visualizations
Test yourself on Working with Dashboards and Visualizations
The full Databricks Data Analyst Associate question bank has 600 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Databricks. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.