[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.PivotFieldCalculation

PivotFieldCalculation Enum

Specifies how a PivotTable data field is calculated.

Use this enumeration with Calculation to change a data field from the default calculation to a custom calculation such as percentage, difference, running total, or rank. These calculation types apply only to data fields.

Namespace: GrapeCity.Documents.Excel
Assembly: DS.Documents.Excel.dll
Syntax
public enum PivotFieldCalculation
Public Enum PivotFieldCalculation
Examples
object[,] sourceData = {
    {"Product", "Country", "Amount"},
    {"Bike", "Australia", 100},
    {"Bike", "Canada", 80}
};
worksheet.Range["A1:C3"].Value = sourceData;
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C3"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"]);
pivotTable.PivotFields["Country"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotField dataField = pivotTable.DataFields["Sum of Amount"];
dataField.Calculation = PivotFieldCalculation.PercentOfTotal;

Fields

Name Description
DifferenceFrom

The difference from the value of the Base item in the Base field.

Index

Data calculated as ((value in cell) x (Grand Total of Grand Totals)) / ((Grand Row Total) x (Grand Column Total)).

NoAdditionalCalculation

No calculation.

PercentDifferenceFrom

Percentage difference from the value of the Base item in the Base field.

PercentOf

Percentage of the value of the Base item in the Base field.

PercentOfColumn

Percentage of the total for the column or series.

PercentOfParent

Percentage of the total of the specified parent Base field.

PercentOfParentColumn

Percentage of the total of the parent column.

PercentOfParentRow

Percentage of the total of the parent row.

PercentOfRow

Percentage of the total for the row or category.

PercentOfTotal

Percentage of the grand total of all the data or data points in the report.

PercentRunningTotal

Percentage of the running total of the specified Base field.

RankAscending

Rank smallest to largest.

RankDecending

Rank largest to smallest.

RunningTotal

Data for successive items in the Base field as a running total.