Sub topic 11
Use Groups and Calculated Fields Together
Assume you can create a basic pivot table and understand SUM, COUNT, and AVERAGE. This chapter combines two pivot-table features: groups that reshape categories, and calculated fields that create new measures.
The working example
Use a source table with one header row and one record per row:
Date Region Product Units Revenue Cost
2026-01-05 West Widget 10 250 150
2026-01-19 East Widget 4 100 60
2026-02-02 West Gadget 7 420 245
2026-02-23 South Gadget 3 180 105
2026-03-09 East Gizmo 12 600 420Create a pivot table from the complete range, including the headers. In the pivot table editor, add Date to Rows and Region to Columns. Add Revenue and Cost to Values, with each field summarized by SUM.
A group changes the labels used by the pivot. For example, you can group the dates by month. A calculated field adds a new value based on source columns. Together, they let you answer questions such as “What was profit by month and region?”
flowchart TD
A[Clean source rows] --> B[Pivot rows and columns]
B --> C[Group dates, items, or numbers]
B --> D[Add calculated field]
C --> E[Compare grouped results]
D --> E
E --> F[Verify totals]caption: Combining a pivot group with a calculated field alt: Clean source data flows into a pivot table, where grouping and a calculated field produce verified summaries.
Add a group first
Select a value in the pivot table, then right-click and choose the grouping command available for that field.
For dates, choose Create pivot date group and select a unit such as Year, Quarter, Month, or Day of week. For numbers, choose Create pivot group rule and set an interval, such as groups of 100 units. For text items, select several labels, right-click, and choose Group items.
Rename a manual group by editing its group label in the pivot table. Use names that explain the business meaning, such as Priority regions or Other regions.
The group becomes a new row or column label. The original source column remains unchanged. This makes grouping useful for analysis without altering the source table.
Add the calculated field
In the pivot table editor, open Values, choose Add, and select Calculated field. Enter a name such as Profit. A calculated field is a pivot value derived from source fields rather than stored as a new source column.
For the example, enter:
=Revenue - CostSet the calculated field to summarize by SUM when you want total profit across the records in each group. If the pivot uses months as rows and regions as columns, each cell shows the profit for that month-region combination.
For example, January West has revenue of 250 and cost of 150, so its profit is 100. January East has profit of 40. February West has profit of 175.
Check the result at each level
Do not check only the grand total. Check one cell manually, then compare the row, column, and grand totals.
| Pivot result | Revenue | Cost | Profit |
|---|---|---|---|
| January, West | 250 | 150 | 100 |
| January, East | 100 | 60 | 40 |
| Grand total | 1,550 | 980 | 570 |
The grand total should satisfy the same relationship: 1,550 minus 980 equals 570. If it does not, inspect the source range, filters, blank values, and summary settings.
Combine multiple grouping features
You can use one group for rows and another for columns. For example, group Date by quarter for rows and manually group regions into West and South and East for columns. Add Profit as a calculated field and Units as another value.
This produces a compact table that compares profit and units across both time groups and region groups. A calculated field does not remove the ability to filter or group the other fields.
Limits and troubleshooting
If grouping is unavailable, check whether the selected cell belongs to the pivot table and whether the source values have mixed types. Text that looks like a date cannot be grouped as a date until it is converted to a real date.
If the calculated field is missing, confirm that the source headers are present and spelled correctly. When a header contains spaces, wrap it in single quotes:
='Unit Price' * QuantityIf a calculated field shows unexpected totals, compare its aggregation method with the question you are asking. A margin percentage, for example, may need a custom formula rather than a sum of row-level percentages.
Exercise
A pivot table groups Date by month and contains Revenue, Cost, and a Profit calculated field. January shows Revenue of 350 and Cost of 210. What should January Profit be, and what should you check if the pivot shows another value?
Show answer
January Profit should be 140. Check that Profit uses the formula =Revenue - Cost, that Revenue and Cost use the intended aggregation, and that the source range includes all January records exactly once.