[]
Serializable, Comparable<PivotFieldCalculation>, ConstableUse this enumeration with IPivotField.setCalculation(PivotFieldCalculation) 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.
Object[][] sourceData = {
{"Product", "Country", "Amount"},
{"Bike", "Australia", 100},
{"Bike", "Canada", 80}
};
worksheet.getRange("A1:C3").setValue(sourceData);
IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C3"));
IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"));
pivotTable.getPivotFields().get("Country").setOrientation(PivotFieldOrientation.RowField);
pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
IPivotField dataField = pivotTable.getDataFields().get("Sum of Amount");
dataField.setCalculation(PivotFieldCalculation.PercentOfTotal);
Enum.EnumDesc<E extends Enum<E>>static PivotFieldCalculationforValue(int value) intgetValue()static PivotFieldCalculationstatic PivotFieldCalculation[]values()name - the name of the enum constant to be returned.IllegalArgumentException - if this enum class has no constant with the specified nameNullPointerException - if the argument is null