[]
Gets or sets the name of the base field used for a custom calculation.
This property is valid only for data fields. Use this property together with Calculation when the data field is configured to show values by a custom calculation such as PercentOf.
string BaseField { get; set; }
Property BaseField As String
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["Product"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Country"].Orientation = PivotFieldOrientation.ColumnField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
IPivotField dataField = pivotTable.DataFields["Sum of Amount"];
dataField.Calculation = PivotFieldCalculation.PercentOf;
dataField.BaseField = "Country";
string baseField = dataField.BaseField;