Sub topic 3
Summarize the data with pivot tables
This chapter assumes you can move around Google Sheets, write a simple formula such as SUM, and read a table with a header row. It also assumes you have built the flat Data sheet from the previous chapter: one header row, one record per row, one value type per column, and no blank rows or merged cells.
A pivot table is a summary table that Sheets builds from your source rows. In the dashboard, it is the layer between the raw data and the charts. Charts read the pivot table, and slicers later filter it.
Why use pivot tables as a summary layer
You could point a chart straight at the Data sheet. That works for a quick look, but it has three drawbacks:
- A chart on raw rows plots one point per row unless you set up aggregation in the chart editor.
- You cannot easily reuse the same grouping for several charts.
- Slicers act on a data range, and a pivot table gives you a clear, named place to apply one.
A pivot table groups rows by one or more fields, then applies a function such as SUM or COUNT to a value field. For the sample data, "revenue by region" is a grouping on Region with a sum of Revenue.
Create your first pivot table
Use this source layout. It is the same table from the previous chapter, and you can extend it with more rows.
Sheet name: Data
A1:F1 headers: Order ID | Order Date | Region | Category | Units | Revenue
A2: 1001 | 2026-01-05 | West | Hardware | 3 | 450.00
A3: 1002 | 2026-01-09 | East | Software | 1 | 120.00
A4: 1003 | 2026-02-02 | East | Hardware | 2 | 300.00To create the pivot table:
- Open the
Datasheet and click any cell inside the table. - Choose Insert > Pivot table.
- In the dialog, check the Data range. Sheets guesses it from the current selection. Change it to something like
Data!A1:Fif you expect new rows later. - Under Insert to, choose New sheet. Sheets adds a tab, often called "Pivot Table 1".
- Rename that tab to something descriptive, such as
Pivot_Region.
Keeping each pivot table on its own sheet matters. A pivot table expands downward and rightward as data grows, and it cannot overwrite cells that already hold values. If another table sits in its path, Sheets shows a "Pivot table would overlap" error.
Configure rows, columns, values, and filters
The pivot table editor on the right has four areas.
| Area | Purpose | Example for this dashboard |
|---|---|---|
| Rows | Each unique value becomes a row | Region |
| Columns | Each unique value becomes a column | Category |
| Values | The number to calculate | Revenue, summarized by SUM |
| Filters | Rules that hide rows before summarizing | Order Date is in 2026 |
Build "revenue by region":
- Next to Rows, click Add and choose
Region. - Next to Values, click Add and choose
Revenue. - Set Summarize by to
SUM.
You should see one row per region and a Grand total at the bottom. For the sample rows, East totals 420 and West totals 450.
Choose the right summarize function
The Values area offers several functions. Pick based on the question:
SUMadds the numbers. Use it for revenue and units.COUNTAcounts non-empty cells. Use it onOrder IDto count orders.AVERAGEgives the mean. Use it with care, because it averages rows, not orders weighted by size.MAXandMINfind extremes.
You can add the same field twice with different functions. For example, add Revenue with SUM and Order ID with COUNTA to see revenue and order count side by side.
Add a column grouping
Add Category under Columns. The pivot table now shows one column per category, which is useful for a stacked or grouped column chart. Keep the number of distinct column values small. A field with many unique values produces a very wide table that charts poorly.
Sort and show totals
Under each Rows field you can set Order (ascending or descending) and Sort by (the label itself or a value such as the sum of revenue). Sorting by revenue descending puts the largest region first, which makes bar charts easier to read. Clear Show totals on a field if you plan to chart the table, because a Grand total row would otherwise appear as one more bar.
Summarize by time
Dates need special handling because individual days are too fine for a dashboard. Add Order Date to Rows. Then right-click a date value in the pivot table, choose Create pivot date group, and pick a grouping such as Year-Month, Month, or Quarter.
This only works when the column contains real dates. If the dates are text, such as 2026-01-05 stored as a string, the group option does not appear. A quick test: select the column and check that Format > Number > Date changes how the cells look. Right-aligned cells are usually real dates, and left-aligned ones are usually text.
Choose the grouping with the question in mind:
| Grouping | Good for | Watch out for |
|---|---|---|
| Year-Month | A trend line across several years | Many points if the history is long |
| Month | Seasonality, comparing January across years | Mixes years together if the year is not also a field |
| Quarter | Executive summaries | Hides short-term changes |
Add calculated fields and filters
A calculated field is a custom value built from other fields. Under Values, click Add > Calculated field, then write a formula that refers to column names. To compute average revenue per unit:
=SUM(Revenue) / SUM(Units)Calculated fields operate on the sums of the fields, not row by row. This is why the formula above gives a weighted average price, which is usually what you want.
Filters inside a pivot table are different from slicers. A pivot filter is part of the table's definition, and it is edited in the side panel. A slicer is a control placed on the sheet that viewers can click. A later chapter covers slicers, but you should know now that the two stack: a row must pass both the pivot filter and the slicer to be counted.
Build a second summary with QUERY
Pivot tables are not the only way to summarize. A QUERY formula builds a similar table in ordinary cells.
=QUERY(Data!A1:F, "select C, sum(F) where C is not null group by C label sum(F) 'Revenue'", 1)The final 1 tells QUERY the range has one header row. In the query string, columns are referred to by letter (C is Region, F is Revenue). The where C is not null clause drops the blank rows that appear when the range extends past the last record.
Compare the two approaches before you decide which to use:
| Feature | Pivot table | QUERY formula |
|---|---|---|
| Setup | Point and click | Write a formula |
| Slicers can filter it | Yes, when the slicer shares its data range | Not directly. The result is ordinary cells |
| Date grouping | Built in | Needs functions such as `month()` in the query |
| Custom layout | Limited | Flexible |
For a slicer-driven dashboard, prefer pivot tables as the summary layer. Use QUERY for supporting tables that no slicer needs to control.
Keep pivot tables healthy
These problems account for most pivot table trouble:
- Range too small. If you set the range to
Data!A1:F4and add row 5 later, the pivot table ignores it. Use an open-ended range such asData!A1:F. - Mixed types in a column. A single text value like
N/AinRevenuemakes Sheets treat part of the column as text, and SUM skips those cells. - Stale or blank headers. Every column used by the pivot table needs a unique, non-empty header.
- Outputs colliding. Keep one pivot table per sheet, or leave generous space between tables.
- Editing the output. You cannot type inside a pivot table. Change it through the editor, or reference its cells from other cells.
After you adjust the source, click the pivot table and check the editor. The pivot table recalculates when the source changes, so you do not need to refresh it by hand.
What you have at the end of this chapter
Your workbook should now contain:
- A
Datasheet with a flat table. - A
Pivot_Regionsheet showing revenue by region, with totals turned off for charting. - Optionally, a second pivot table grouped by month, and a QUERY summary for comparison.
The next chapter turns these summaries into charts.
Exercise
A pivot table shows revenue by region, but it ignores 40 rows you added below the original data. The data range is Data!A1:F100 and the table now has 140 records. What is the fix, and why does an open-ended range help?
Show answer
Change the pivot table's Data range to Data!A1:F, which has no end row. A fixed range stops at row 100, so rows 101 to 141 are outside the pivot table's input. An open-ended range includes every row that is added later, so you do not have to edit it again.
Exercise
You add Order Date to Rows, but right-clicking a date does not offer "Create pivot date group". Name the likely cause and one way to check it.
Show answer
The dates are probably stored as text instead of real date values. Check by selecting the column and applying Format > Number > Date. If the cells do not change appearance or stay left-aligned, they are text. Convert them, for example with DATEVALUE, and the date grouping option will appear.