What you will be able to do
- Create a visualization from a notebook or SQL editor result set using the visualization editor
- Edit, duplicate, rename, filter, and remove visualization tabs, and predict how filters propagate
- Apply and disable Y-axis aggregation inside the visualization editor
- Explore a chart with legend, zoom, and download controls, and send it to a dashboard
Key concept
Result-attached visualization — In Databricks notebooks and the SQL editor, a visualization is not a separate object you build elsewhere. It is a tab on a query or cell result, created through the visualization editor, and it lives beside the results table it was built from.
1.From a result set to a chart
Every visualization in a notebook or the SQL editor starts with a result set. In the SQL editor you run a query. In a notebook you run a SQL cell, or a Python cell that ends with display() on a DataFrame. The Databricks example works out how many taxi trips end in each hour, using the samples.nyctaxi.trips table. Its Python version finishes with the call that renders the result in the notebook:
Checkpoint 1 of 7· Fill the gap
Which call renders the DataFrame as a notebook result that you can then build a visualization on?
? (result_df)The documentation's notebook example ends with display(result_df). That call produces the results table, and the + menu for adding a visualization appears above it.
Source: docs.databricks.comOnce a result is on screen, the workflow is the same in both tools. Click + above the result and choose Visualization, which opens the visualization editor. In the notebook quick-start, the + sits next to the Table tab. Pick a chart from the Visualization Type drop-down, map columns to the chart (for example an X column, a Y column and its aggregation, and a Group by column), and click Save. The chart is saved as a new tab next to the results table. In the SQL editor, the results pane is described as a place to explore results, and visualizations are one of the tools it offers for that.
Checkpoint 2 of 7· Put it in order
Put the steps for creating a visualization in order.
- 1.Click Save
- 2.Select the data to appear in the visualization
- 3.Choose a chart in the Visualization Type drop-down
- 4.Run the query or cell so a result set appears
- 5.Click + above the result and select Visualization
The editor opens from the + menu on an existing result. You choose the type first, then the data, then save.
“In the Visualization Type drop-down, choose a type. Then, select the data to appear in the visualization.”Source: docs.databricks.com
Checkpoint 3 of 7· Exam question
An analyst runs a SQL query in a Databricks notebook cell and gets back a result table. They want to turn part of that result into a chart without leaving the cell or writing any plotting code. What should they do?
Correct answer: A — Click the `+` button above the result table, choose Visualization, then pick a chart type and configure it in the editor that opens.
- A. The `+` button above a cell's result table opens the visualization editor directly, letting the analyst pick a chart type and configure fields without leaving the notebook. This is the documented entry point for creating a visualization from a query result.
- B. Exporting to CSV and charting in an external spreadsheet is a real workaround some analysts use, but it abandons the notebook entirely and duplicates data outside Databricks, which is unnecessary since the `+` button already builds charts in place.
- C. Rerunning the query in the SQL editor works for building a visualization there, but it is a redundant extra step since the notebook cell already exposes the same visualization editor on its own result table.
- D. Building a dashboard first and wiring the query in as a dataset is how a chart gets added to a shared dashboard later, but it is far more setup than needed just to chart a result the analyst is already looking at in the cell.
2.Editing, duplicating, and filtering visualization tabs
After you save it, the visualization is a tab. Most management actions are in one place: the downward-pointing arrow to the right of the tab name. That menu has Edit, Duplicate, and Remove. In the SQL editor it also has Rename, Download (the data behind the visualization as CSV, TSV, or Excel), and Add to dashboard. You can also rename a tab by clicking its name and typing over it. Edit reopens the visualization editor, whose tabs give you access to the different parts of the chart. Duplicate clones the visualization, so you can try a variation without losing the original.
To filter, click the filter control in the upper-right corner of the visualization and enter the conditions. The filter is shared in both directions: a filter on the visualization narrows the results table, and a filter on the results table narrows the visualization. If a chart and its table disagree with what you expected, check for a filter on the other tab first.
Checkpoint 4 of 7· Check yourself
A colleague filtered the results table of a SQL cell to the last 30 days. Their line chart on the same result now shows only those 30 days. Why?
Filters are shared between a result's table and its visualizations. The query was not rewritten.
“Filter(s) applied on the results table will also apply to the visualization.”Source: docs.databricks.com
3.Aggregating in the visualization, not the query
For Line, Bar, Area, Pie, Heatmap, and Histogram, you can aggregate inside the visualization instead of adding a GROUP BY column to your code. Databricks gives three reasons to do this. You don't have to change the code that produces the result. You can switch the aggregation to try different scenarios. And the aggregation covers the full dataset, not just the 64,000 rows the table displays.
When you create or edit a chart, choose the aggregation next to the Y-axis columns. Numeric columns offer Sum (the default), Average, Count, Count Distinct, Max, Min, and Median. String columns offer only Count and Count Distinct. After you save, the visualization shows how many rows it aggregated. If your query already aggregates and you want the chart to plot the values as they are, open the kebab menu next to Y columns and uncheck Use aggregation.
Charts built with the older configuration show the message *This visualization uses an old configuration*. You can't add aggregation to them until you re-create them.
| Y column type | Available aggregations | Default |
|---|---|---|
| Numeric | Sum, Average, Count, Count Distinct, Max, Min, Median | Sum |
| String | Count, Count Distinct | Not stated in the source |
Checkpoint 5 of 7· Check yourself
Your SQL already returns one pre-aggregated total per month. The bar chart is applying Sum on top of it, and you want the values plotted exactly as returned. What do you do?
Aggregation in the editor can be turned off per chart, which leaves the query's own aggregation untouched.
“To turn off aggregation, click the kebab menu next to Y columns and uncheck Use aggregation.”Source: docs.databricks.com
Checkpoint 6 of 7· Exam question
An analyst wants a widget that shows today's daily active user count as one large prominent number, compares it against yesterday's total, and shows a small trend line underneath. Which visualization type fits this requirement?
Correct answer: A — A counter visualization, since it displays a single value prominently with an optional offset comparison and an optional sparkline.
- A. A counter is built exactly for this: a single prominent value, an offset comparison against a prior period, and an optional sparkline trend beneath it. That combination of features matches the daily-active-users requirement precisely.
- B. A line visualization is designed to plot a metric's change across a continuous axis like time, which is useful for trend analysis but does not produce the single large comparison number the scenario asks for.
- C. A bar visualization compares metrics across categories or time buckets using bars, which suits grouped comparisons but not a single headline number with an embedded sparkline.
- D. A table visualization lays results out as rows and columns for browsing many values at once, which does not produce the prominent single-number display the scenario calls for.
Sources1
4.Exploring a chart and sending it onward
A saved chart is interactive. Use Colors in the editor to change a series' color, either with the color picker or by entering a hex value. In the legend, click a series to hide it and click it again to show it. Double-click a series to show only that one, and Cmd/Ctrl + click to select or deselect several series. For crowded charts, click and drag on the canvas to zoom in, then use Clear zoom in the upper-right corner to reset. To export the chart as an image, hover over the canvas and click the download icon, which saves a PNG. The latest chart version is on by default. On older (legacy) charts, the same zoom and pan controls are on a Plotly toolbar, which an administrator can turn off.
Double-click one of the two series to show only that series, then click the second one to add it back. Alternatively, Cmd/Ctrl + click legend items to select several series at once.
To move a visualization onto a dashboard, open the tab's arrow menu and choose Add to dashboard. In the SQL editor, you can add the query and its visualizations either to a new AI/BI dashboard (saved to your Home folder) or to an existing one. In notebooks there is a limit that is easy to miss: the Add to dashboard item appears only for SQL cells. A visualization from a Python cell, or a data profile, can be added only to a notebook dashboard.
Checkpoint 7 of 7· Check yourself
You built a bar chart on the output of a Python cell that calls display(result_df). Where can you add this visualization?
Visualizations from non-SQL cells, and data profiles, can go only to a notebook dashboard. The Add to dashboard menu item appears for SQL cells.
“the associated visualization and data profile can only be added to a notebook dashboard”Source: docs.databricks.com
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Aggregation in a chart only covers the 64,000 rows shown in the results table.Why is that wrong?
For the chart types that support it, aggregation in the visualization editor runs over the entire dataset.
2.A filter on a visualization affects only that chart.Why is that wrong?
Filters are shared in both directions between a visualization and its results table.
Covered in Editing, duplicating, and filtering visualization tabs
3.Any notebook visualization can be sent to an AI/BI dashboard with Add to dashboard.Why is that wrong?
That menu item appears only for SQL cells. Visualizations from other languages, and data profiles, can go only to a notebook dashboard.
Covered in Exploring a chart and sending it onward
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.databricks.com/aws/en/visualizationsOfficial docs
“To create a visualization, click + above a result and select Visualization to open the visualization editor.”
↩︎ From a result set to a chart“To remove, duplicate, or edit a visualization or data profile, click the downward pointing arrow at the right of the tab name.”
↩︎ Editing, duplicating, and filtering visualization tabs“Next to the Y-axis columns, select the aggregation type from the following for numeric types: Sum (the default)”
↩︎ Aggregating in the visualization, not the query“you must re-create the visualization before you can use aggregation.”
↩︎ Aggregating in the visualization, not the query“To show only a single series, double-click the series in the legend.”
↩︎ Exploring a chart and sending it onward“You can create visualizations in the same UI where the results table appears.”
↩︎ Key concept“The aggregation applies to the entire dataset, not just the first 64,000 rows displayed in a table.”
↩︎ Exam trap 1“Filter(s) applied on a visualization will also apply to the results table.”
↩︎ Exam trap 2“For SQL cells, you'll see an additional Add to dashboard menu item in the drop down.”
↩︎ Exam trap 3“In the Visualization Type drop-down, choose a type. Then, select the data to appear in the visualization.”
↩︎ Checkpoint“Filter(s) applied on a visualization will also apply to the results table.”
↩︎ Prediction“Filter(s) applied on the results table will also apply to the visualization.”
↩︎ Checkpoint“The aggregation applies to the entire dataset, not just the first 64,000 rows displayed in a table.”
↩︎ Prediction“To turn off aggregation, click the kebab menu next to Y columns and uncheck Use aggregation.”
↩︎ Checkpoint“the associated visualization and data profile can only be added to a notebook dashboard”
↩︎ Checkpoint - 2.
“Next to the Table tab, click + and then click Visualization. The visualization editor displays.”
↩︎ From a result set to a chart - 3.
“Visualizations can help explore the result set.”
↩︎ From a result set to a chart“Click Download to download the data represented in the visualization as a CSV, TSV, or Excel file.”
↩︎ Editing, duplicating, and filtering visualization tabs“Click Add to dashboard to copy the query and visualization to a new AI/BI dashboard.”
↩︎ Exploring a chart and sending it onward