Microsoft Office Tutorials and References

In Depth Information

**20.7.8.3 Calculations requiring a BaseField/BaseItem**

20.7.8.3 Calculations requiring a BaseField/BaseItem

The procedure for making calculations with a BaseField/BaseItem is not explained very well in

the documentation, so let us see if we can clear it up by first considering an example. Consider the

code:

With ActiveSheet.PivotTables("Sales&Trans"). _

PivotFields("Sale")

.Calculation = xlDifferenceFrom

.BaseField = "Store City"

.BaseItem = "Boston"

End With

Referring to
Figure 20-32
, we have reproduced our usual pivot table (from
Figure 20-10
) with

several changes. First, we removed the Trans values, since they are not relevant to our example.

We have also replaced the Sale values for the given BaseField and BaseItem by symbols (
b1-b8
).

Finally, we replaced the other Sale values with number signs, since we do not care about the

actual values.

Figure 20-32. Illustrating a calculation