Skip to content

Pivot table calculated fields ignored in calculation #2288

@swmal

Description

@swmal

When a pivot table contains calculated fields (fields defined by a formula in the pivot cache, e.g. 'Basic Pay'+'Backpay'+...), these fields are not computed during pivot table calculation. This causes GETPIVOTDATA to return #REF! for any data field that references a calculated field.

Root cause

The calculation logic searches for calculated fields by iterating the pivot table's field collection (ExcelPivotTable.Fields), which only contains source data columns. Calculated fields exist exclusively as cache fields with indices beyond the source data range and are therefore never found.
As a result:

  • GetCalcOrder() returns an empty list
  • CalculateSourceFields() produces no referenced items
  • CalculatedItems remains empty for all affected data fields

Impact

The issue affects any pivot table where data fields are based on calculated cache fields rather than direct source columns.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Pending Release

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions