Pivot tables

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 instead of SQL code.


If your query result is too large pivot table performance can degrade. The exact size threshold will depend on the computer and browser from which you access SQL Analytics. In general, performance is best with at most 50,000 fields. That could mean 10,000 records with 5 fields each. Or 1,000 records with 50 fields each.

The query for a pivot table should return at least three columns. The source query for a pivot table is usually non-aggregated or “melted”.

The following example shows mock data from a school grading system. The query doesn’t group or sort the data.

Example query for pivot table

Create a pivot table visualization

  1. Click + Add Visualization.

  2. In the Visualization Type drop-down, select Pivot Table. The visualization preview on the right updates to show a pivot table.

    All the field aliases from your query result become available at the top of the pivot control surface. You can drag these to the row side or the column side. You can also nest them.

    Here are some examples using the grade data:

    Pivot examples