New Tool Radar

AI for Data & Spreadsheets

How to Check Whether an AI-Written Pivot Calculated Field Uses Source Values or Summarised Totals

Check whether a pivot calculated field computes from the source values, instead of from totals that were already summed.

Schematic with three steps: Open the calculated field definition; Work out one value by hand from; Compare the hand value with the pivot.

A calculated field in a PivotTable is a new field defined by a formula, and Excel computes it from the underlying source values, not from the summarised totals shown in the pivot. That distinction surprises readers: a calculated field that divides one total by another can give a different answer from a formula typed beside the pivot. Check the field definition against the source before trusting the numbers.

What you need

  • The pivot table and its calculated field definition
  • The source rows the pivot was built from
  • A hand-worked answer for one row of the pivot

Step 1: Open the calculated field definition

Select the pivot, open PivotTable Analyze, Fields, Items and Sets, Calculated Field, and read the formula. Write down which source fields it uses and what it does with them.

Step 2: Work out one value by hand from the source

Pick one row of the pivot, go back to the source rows behind it, and work out the calculated field’s value by hand from those rows, not from the pivot totals.

Step 3: Compare the hand value with the pivot value

If the two agree, the field is sound. If they differ, the field is probably dividing summarised totals; rewrite it as a ratio computed from the source fields, or add the calculation to the source data instead.

Worked example: synthetic margin calculated field

The table below is a synthetic example. It shows the expected result of checking an AI-written pivot calculated field; no formula was run.

Check Value Result
Source rows for East Sales 400, Profit 80 Margin 20%
Pivot totals used by hand 80 / 400 20%
Calculated field result 20% Matches the hand value
Wrong method (average of margins) 22% Averages the row margins

Expected result (UNTESTED). the calculated field returns 20% for East, matching the hand value worked out from the source rows; averaging the row margins instead would give 22%. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A calculated field cannot use a value from another calculated field, and it cannot refer to a single pivot cell.
  • Calculated fields always summarise first and then calculate, so a ratio of sums is not the same as a sum of ratios.
  • If the source data changes, the pivot must be refreshed before the calculated field updates.
  • A calculated field name must not match an existing field name, or the pivot refuses it.

Sources

See all