What you will be able to do
- Create, edit, rename, duplicate and remove a visualization tab on a notebook or SQL editor result
- Tell which notebook/SQL editor chart types aggregate the full result and which truncate at 64,000 rows
- Aggregate Y-axis columns in the visualization, or turn aggregation off to keep a query's own aggregation and sort order
- Configure shared chart options, number formats and table-visualization column formatting
- Configure choropleth maps by region key and marker maps by latitude/longitude
Key concept
In-visualization aggregation — Many chart types in notebooks and the SQL editor can aggregate the result themselves, for example by summing a Y column per X value, so you do not have to rewrite the query. Charts that aggregate on the backend cover the whole result. Others only read the first 64,000 rows.
1.Creating and managing visualization tabs on a result
A visualization in a notebook or the SQL editor is a tab attached to a query result. You build it in the same pane as the results table, with no plotting code and no separate tool. To start one, click + above the result and choose Visualization. The visualization editor opens. Pick a chart type from the Visualization Type drop-down, choose the columns to plot, and click Save. The chart appears as a new tab beside the results table, and that tab keeps a live link to the result it was built from.
USE CATALOG samples;
SELECT
hour(tpep_dropoff_datetime) as dropoff_hour,
COUNT(*) AS num
FROM samples.nyctaxi.trips
WHERE pickup_zip in ('10001', '10002')
GROUP BY 1;After a tab exists, you manage it from the downward-pointing arrow at the right of its name. That menu has these actions:
- Edit reopens the visualization editor. The editor has its own tabs for each part of the chart.
- Duplicate clones the visualization. This is the quick way to try a second chart type without losing the first.
- Rename retitles the tab. You can also click the tab name and edit it in place.
- Remove deletes the visualization.
- Download saves the data behind the visualization as a CSV, TSV or Excel file.
- Add to dashboard copies the query and its visualization into an AI/BI dashboard, either a new one or an existing one.
The cell's language decides where the chart can go. In a notebook, if the cell runs a language other than SQL, or the tab is a data profile, the visualization can only be added to a notebook dashboard. SQL cells get the extra Add to dashboard menu item.
A visualization and its results table share their filters, and the link runs both ways. A filter set on the results table also applies to every visualization tab on that result. A filter set on a visualization, from the filter control in its upper-right corner, also applies to the results table. How to define those filters is covered in Query filters in the results panel. The consequence here is that a filter you forget about on the table will quietly reshape every chart built on it.
Checkpoint 1 of 9· Put it in order
You have just run the drop-offs-per-hour query in the SQL editor and want a bar chart of it. Put these steps in order.
- 1.Choose Bar from the Visualization Type drop-down
- 2.Select the columns to plot, such as dropoff_hour and num
- 3.Click + above the query result and select Visualization to open the visualization editor
- 4.Click Save, so the chart appears as a new tab beside the results table
You open the visualization editor from the + above the result. In the editor you pick the chart type first and then the data to plot. Save adds the chart as a tab that stays linked to that result.
“In the Visualization Type drop-down, choose a type. Then, select the data to appear in the visualization.”Source: docs.databricks.com
Checkpoint 2 of 9· 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.Chart types in the editor and the 64K-row limit
The Visualization Type drop-down offers about twenty types. They fall into three groups, depending on how much of the result each type actually reads. Picking a type for a business question is covered in Choosing a chart type from the question. What matters here is which types the notebook and SQL editor offer, and which of them stop reading at 64,000 rows.
| Group | Types | What happens with more than 64K rows |
|---|---|---|
| Backend aggregation | Area, bar, bubble, combo, heatmap, histogram, line, pie, pivot table, scatter | Full result is aggregated, with no truncation |
| Aggregates up to 64,000 rows | Box, counter, funnel, word cloud, pivot table (legacy) | Data beyond 64,000 rows is truncated |
| No aggregation in the visualization | Choropleth, marker, sankey, sunburst, table | All aggregation must be done in the query itself |
| Date aggregation only | Cohort | Only aggregates over dates (monthly); other aggregation is done in the query |
Each type answers a different kind of question. Line charts show how one or more metrics change over time. Bar charts show change over time or proportionality. Pie charts show proportionality between metrics and are not meant for time series. A revenue split across five categories for one quarter suits a pie, and a monthly trend does not. Area and combo charts both follow a value as a second variable progresses, usually time. Scatter charts relate two numeric variables, and a bubble chart is a scatter chart where marker size encodes a third metric.
A counter shows one value in large type and can compare it with a target value. You choose which row feeds the Value Column and which row feeds the Target Column. The query below sorts dates newest first, so row 1 is today's average and row 2 is the previous day's. In AI/BI dashboards the counter also compares against an offset value and can draw a sparkline from a date column and an aggregation. That makes it the widget for a headline metric next to its prior period and a small trend line.
select o_orderdate, avg(o_totalprice)
from samples.tpch.orders
GROUP BY 1
ORDER BY 1 DESCCheckpoint 3 of 9· Check yourself
A query returns 300,000 order rows, one row per order. Without changing the query, you want a chart of total price per order priority that counts every row. Which visualization does this?
Bar charts aggregate on the backend, so they sum all 300,000 rows without truncating any. Funnel charts and legacy pivot tables stop aggregating at 64,000 rows. A sunburst does no aggregation of its own, so the sums would have to be written into the query.
“Bar charts support backend aggregations, providing support for queries returning more than 64K rows of data without truncation of the result set.”Source: docs.databricks.com
Checkpoint 4 of 9· 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.
Checkpoint 5 of 9· Exam question
An analyst has a query result showing revenue share across five product categories for the most recent quarter only, with no time trend involved. Which visualization choice correctly matches the documented guidance for this case?
Correct answer: A — A pie visualization, since it shows proportionality between metrics and is not recommended for time series data.
- A. A pie chart shows proportionality between metrics and is explicitly documented as unsuited to time series, which fits a single-quarter proportional breakdown with no trend dimension.
- B. A line visualization exists to plot a metric's change over a continuous progression such as time, which does not apply here since the scenario has no trend to plot.
- C. An area visualization tracks how grouped values change over a second variable, typically time, which again does not fit a single-quarter snapshot with no progression.
- D. A waterfall chart shows the cumulative effect of sequential positive and negative changes across stages, which suits contribution analysis rather than a static proportional breakdown.
3.Aggregating in the visualization instead of the query
Bar, line, area, pie, heatmap and histogram charts can aggregate inside the visualization, so you do not need to add an aggregate column to the query. This has three advantages. The code that produces the result stays unchanged. Switching from Sum to Average becomes a quick way to test different scenarios. And the aggregation covers the entire dataset, not only the first 64,000 rows shown in the results table. That last point is why a select * from samples.tpch.orders result can still feed an accurate monthly revenue bar chart.
You set the aggregation per Y-axis column in the visualization editor. Numeric columns offer Sum (the default), Average, Count, Count Distinct, Max, Min and Median. String columns offer only Count and Count Distinct. After you click Save, the chart shows how many rows it aggregated, which is a quick check that you are not looking at a truncated result. Some older charts show the message "This visualization uses an old configuration". Editing such a chart does not unlock aggregation; you have to re-create the visualization first.
Turn aggregation off when the query has already aggregated. Suppose a query returns GROUP BY totals with an ORDER BY, and the chart applies its own Sum on top. The chart then re-sums the totals and can lose your sort order. In the kebab menu next to the Y columns, uncheck Use aggregation (the chart options call this Disable aggregations). The chart then plots values as returned and keeps the query's sort order.
Checkpoint 6 of 9· Check yourself
Your query already returns one row per order priority. It uses SUM(o_totalprice) with GROUP BY, then ORDER BY total DESC. You build a bar chart on it and leave the Y column on the default Sum, and the bars don't follow the query's order. What should you change so the chart plots the totals exactly as the query returns them?
With Sum left on, the chart aggregates the query's totals again and can lose the sort order. Turning off Use aggregation (Disable aggregations) plots the values as returned and keeps the ORDER BY. Line charts also aggregate by default, and re-creating the chart or dropping the query's aggregation does not keep the sort.
“This will ensure no aggregation is applied, and ensure any sort order in your query is maintained in the visualization.”Source: docs.databricks.com
4.Options shared across chart types
Bar, line, area, pie, scatter, bubble and combo charts share one set of editor tabs, so you only learn the controls once. General holds the required X and Y columns. It also holds Group by, which splits values into coloured legend entries, plus an error column, legend placement and order, and a horizontal-chart toggle that flips the axes. X axis and Y axis set the scale type (categorical, linear or logarithmic), axis names, label visibility and a custom Y range. Options sets series order, series labels, left or right Y-axis assignment, and whether each series is drawn as a bar or a line. Colors and Data labels complete the set.
Three General settings change what the chart says, not just how it looks. Stacking either layers series on top of each other to show cumulative values or places them side by side when grouped. Normalize values to percentage turns each series into its share of the group total. Missing and NULL values either plots gaps as 0 or hides them. Plotting them as 0 can draw a false dip in a line chart where data was simply absent.
Format strings in the data labels control how numbers appear. They apply to numbers in table visualizations and in chart hover tooltips. They do not apply to axis values, so formatting a Y column as currency leaves the axis ticks unchanged.
| Number | Format | Output |
|---|---|---|
| 10000.23 | '0,0' | 10,000 |
| 1230974 | '0.0a' | 1.2m |
| 1000.234 | '$0,000.00' | $1,000.23 |
| 97.4878234 | '0.000%' | 97.488% |
| 1 | '0o' | 1st |
You can also explore a saved chart without editing it:
- Click a legend entry to hide or show that series, and double-click to show only that series.
- Cmd/Ctrl-click legend entries to select several series.
- Click and drag on the canvas to zoom, and use Clear zoom to reset.
- Click the download icon in the upper-right corner to save the chart as a PNG.
Checkpoint 7 of 9· Match them up
Each of these General-tab settings is shared by bar, line, area and the other common charts. Match each setting to what it does to the chart.
Tap a term, then the definition that fits it.
Group by, Stacking, Normalize, Missing and NULL values, and Horizontal chart all live on the General tab. Group by, Stacking, Normalize and the NULL setting change what the chart tells the reader. Horizontal chart only changes its orientation.
“Normalize values to percentage: When multiple series are used, each series will show a percentage of the total value of the underlying grouping”Source: docs.databricks.com
5.Formatting a table visualization
A table visualization is separate from the cell's results table. You can reorder, hide and format its columns without changing the raw output. It can display up to 100,000 rows, and it does no aggregation, so any totals have to come from the query. In the column list, drag the handle to reorder columns and toggle the icon to hide them. The kebab menu on a column header lets you copy the column name, add a filter, format the column, or pin it so it stays visible while you scroll right.
Format handles common types such as text, numbers, dates and Booleans. It can show floats to three decimal places, show only the month and year of a date, zero-pad integers, or add text before or after a number. The Display as field adds three special types. Image renders image URLs inline. JSON shows collapsible JSON. Link builds clickable links from URL, text and title templates. These templates use mustache-style {{column}} parameters and support a urlEscape pipe filter. With Allow HTML content enabled, HTML is passed through a sanitizer and rendered. With it disabled, the HTML is shown as plain text.
Font conditions colour cell text by comparing the cell value with a threshold. Under Font Conditions, click + Add condition and choose the column, comparator, threshold and font colour. The threshold must have the same data type as the column, or the comparison never matches. That rules out the habit of typing thousands separators. To highlight values above five hundred thousand, enter > 500000, not > 500,000.
Checkpoint 8 of 9· Check yourself
In a table visualization, the revenue column uses the number format '0,0', so its cells show values like 1,250,000. You add a font condition to colour revenue above five hundred thousand red. You entered the threshold as > 500,000, and no cells change colour. What fixes it?
The comparison only succeeds when the threshold has the same data type as the column. A numeric threshold is therefore typed without thousands separators, as > 500000, whatever display format the column uses. Table visualizations do no aggregation, and the column's display format is not what gets compared.
“For the comparison to succeed, the threshold must be the same data type as the column.”Source: docs.databricks.com
6.Choropleth and marker maps
The two map types need different data in the result. A choropleth colours whole regions, such as countries or states, so the result must include each region by name. A marker map puts a pin at a point, so the result must include latitude and longitude pairs. Neither type aggregates in the visualization. Aggregate per region or per point in the query first.
SELECT
initcap(n_name) as Country,
sum(c_acctbal)
FROM samples.tpch.customer
join samples.tpch.nation where n_nationkey = c_nationkey
GROUP BY 1A choropleth has four required settings. Map picks the base map: Countries, USA or Japan/Prefectures. Geographic column is the column that holds the region key. Geographic type states how those keys are written. Value column holds the number that sets each region's colour. Geographic type is where maps go wrong: a key that does not match the chosen format draws nothing for that region. The query above returns names like Brazil through initcap, so it works with Short name, but the same rows set to ISO code (2 letters) would leave the map blank.
| Geographic type | Example values |
|---|---|
| Abbreviated name | U.S.A, Brazil |
| Short name | United States, Brazil |
| Full name | United States, Brazil |
| ISO code (2 letters) | US, BR |
| ISO code (3 letters) | USA, BRA |
| ISO code (numeric) | 840, 076 |
Clustering mode decides how values map to colour steps between Min Color and Max Color. Equidistant, the default, makes every step cover the same range. Quantile puts the same number of regions in each step and may use fewer steps than you asked for. K-mean groups regions around shared means. Use Quantile when a few very large values would otherwise push every other region into the bottom colour. No Value Color and Value placeholder, which defaults to N/A, control how regions with no result are shown.
A marker map needs a Latitude column and a Longitude column. A Group by column can override the query's own grouping. Turning on Cluster markers merges nearby markers into a single marker that shows how many it contains, which keeps dense data readable. You can also set map tiles, tooltip and popup templates, and override the marker shape, icon and colours.
Checkpoint 9 of 9· Match them up
You're building a choropleth of revenue by country and a marker map of store locations. Pair each map setting with what it controls.
Tap a term, then the definition that fits it.
On a choropleth, Geographic type has to match how the keys are actually written. If it doesn't, those regions draw nothing. Map picks the base map, and Quantile balances the colour steps by how many regions fall in each. Cluster markers is a marker-map option that groups pins that are close together.
“If a geographic column value doesn't match one of the target field formats, no data is shown for that locality.”Source: docs.databricks.com
Practise it for real
Build, aggregate, duplicate and filter a chart on the NYC taxi sample result in the SQL editor
1.Run the drop-offs-per-hour query against samples.nyctaxi.trips in the SQL editor.
Why: A visualization is always attached to a result, so you need one first.
You should see: A results table with dropoff_hour and num columns.
2.Click + above the result, choose Visualization, set Visualization Type to Bar, X column dropoff_hour, Y column num, and click Save.
Why: This is the standard way to create a visualization tab.
You should see: A new bar-chart tab next to the results table.
3.Edit the chart and change the Y aggregation on num from Sum to Average, then save.
Why: Changing the aggregation in the visualization lets you try a scenario without editing the query.
You should see: Bar heights change and the chart reports how many rows it aggregated.
4.From the tab's down-arrow menu choose Duplicate, then add a filter on the results table that keeps only some hours.
Why: This shows that duplicates are independent charts while filters are shared with the result.
You should see: Both chart tabs show only the filtered hours.
Stuck? Get a nudge
If the chart only offers Sum and nothing else changes, look for the old-configuration message and re-create the visualization.
Sources
(8)
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.”
↩︎ Creating and managing visualization tabs on a result“To remove, duplicate, or edit a visualization or data profile, click the downward pointing arrow at the right of the tab name.”
↩︎ Creating and managing visualization tabs on a result“the associated visualization and data profile can only be added to a notebook dashboard”
↩︎ Creating and managing visualization tabs on a result“Filter(s) applied on the results table will also apply to the visualization.”
↩︎ Creating and managing visualization tabs on a result“The aggregation applies to the entire dataset, not just the first 64,000 rows displayed in a table.”
↩︎ Aggregating in the visualization instead of the query“Or from the following for string types: Count Count Distinct”
↩︎ Aggregating in the visualization instead of the query“you must re-create the visualization before you can use aggregation.”
↩︎ Aggregating in the visualization instead of the query“To show only a single series, double-click the series in the legend.”
↩︎ Options shared across chart types“The aggregation applies to the entire dataset, not just the first 64,000 rows displayed in a table.”
↩︎ Key concept“In the Visualization Type drop-down, choose a type. Then, select the data to appear in the visualization.”
↩︎ Checkpoint - 2.
“Click Download to download the data represented in the visualization as a CSV, TSV, or Excel file.”
↩︎ Creating and managing visualization tabs on a result“Click Add to dashboard to copy the query and visualization to a new AI/BI dashboard.”
↩︎ Creating and managing visualization tabs on a result - 3.
“Bar charts support backend aggregations, providing support for queries returning more than 64K rows of data without truncation of the result set.”
↩︎ Chart types in the editor and the 64K-row limit“Word cloud only supports aggregation for up to 64,000 rows.”
↩︎ Chart types in the editor and the 64K-row limit“Pie charts show proportionality between metrics. They are not meant for conveying time series data.”
↩︎ Chart types in the editor and the 64K-row limit“Line charts present the change in one or more metrics over time.”
↩︎ Chart types in the editor and the 64K-row limit“Counters display a single value prominently, with an option to compare them against a target value.”
↩︎ Chart types in the editor and the 64K-row limit“Table visualizations can display up to 100,000 rows.”
↩︎ Formatting a table visualization“Choropleth visualizations do not do any aggregations of data within the result set. All aggregations must be computed within the query itself.”
↩︎ Choropleth and marker maps“Marker does not do any aggregations of data within the result set.”
↩︎ Choropleth and marker maps“Counter only supports aggregation for up to 64,000 rows. If a dataset is larger than 64,000 rows, data will be truncated.”
↩︎ Exam trap 1“Box charts only support aggregation for up to 64,000 rows. If a dataset is larger than 64,000 rows, data will be truncated.”
↩︎ Prediction - 4.
“Optionally, choose a date column and aggregation to show a sparkline in the chart.”
↩︎ Chart types in the editor and the 64K-row limit - 5.
“This will ensure no aggregation is applied, and ensure any sort order in your query is maintained in the visualization.”
↩︎ Aggregating in the visualization instead of the query“When stacked, values belonging to multiple series will be layered on top of each other to show cumulative values.”
↩︎ Options shared across chart types“each series will show a percentage of the total value of the underlying grouping, rather than a raw number.”
↩︎ Options shared across chart types“This will ensure no aggregation is applied, and ensure any sort order in your query is maintained in the visualization.”
↩︎ Exam trap 2“Normalize values to percentage: When multiple series are used, each series will show a percentage of the total value of the underlying grouping”
↩︎ Checkpoint - 6.
“That formatting applies to numbers in the table visualization and when hovering over data points on a chart visualization”
↩︎ Options shared across chart types - 7.
“A table visualization can be manipulated independently of the original cell results table.”
↩︎ Formatting a table visualization“The fields accept mustache-style parameters (double curly braces) for the column names in the table.”
↩︎ Formatting a table visualization“Enabled: HTML content is run through an HTML sanitizer and the column is rendered as HTML.”
↩︎ Formatting a table visualization“For the comparison to succeed, the threshold must be the same data type as the column.”
↩︎ Formatting a table visualization“create the threshold > 500000, rather than > 500,000.”
↩︎ Exam trap 4 - 8.
“The query result must return latitude and longitude pairs.”
↩︎ Choropleth and marker maps“Map: Which geographic map to use. One of Countries, USA, or Japan/Prefectures.”
↩︎ Choropleth and marker maps“If a geographic column value doesn't match one of the target field formats, no data is shown for that locality.”
↩︎ Choropleth and marker maps“Quantile: Results are segmented into a number of segments less than or equal to the value you specify in the Steps field”
↩︎ Choropleth and marker maps“markers that are close to each other are clustered into a single marker that indicates the number of markers in the cluster”
↩︎ Choropleth and marker maps“If a geographic column value doesn't match one of the target field formats, no data is shown for that locality.”
↩︎ Exam trap 3