Pivot tables in Databricks notebooks

The pivot table visualization aggregates records from a query result into a new tabular display. It’s similar to PIVOT or GROUP BY statements in SQL. You configure the pivot table visualization with drag-and-drop fields.

The first 12 rows of the data used for the examples in this article are shown below.

Example data for pivot table

Pivot table visualization examples

When you select Pivot Table from the Visualization Type drop-down, the visualization preview on the right updates to show a pivot table. The columns from your table are shown at the top of the pivot controls. You can drag these to the row side or the column side. You can also nest them.

Here are some examples:

Pivot examples