officefileapi-devexpress-dot-spreadsheet-dot-pivotcalculatedfieldcollection-dot-add-x28-system-dot-string-x29.md
Creates a new calculated field and appends it to the collection.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
PivotField Add(
string formula
)
Function Add(
formula As String
) As PivotField
| Name | Type | Description |
|---|---|---|
| formula | String |
The formula used to calculate field values.
|
| Type | Description |
|---|---|
| PivotField |
The newly created calculated field.
|
Use the Add method to add a calculated field to the PivotTable report. The default name (Field1, Field2, …) is assigned to the new field. Use the PivotField.Name property to rename the field.
A formula for the calculated field should conform to the common syntax rules and contain only supported elements:
After the calculated field is created, call the PivotTable.DataFields.Add method to add the field to the PivotTable’s data area.
Refer to the following topic for more information on how to create and modify calculated fields: How to: Create a Calculated Field.
See Also
How to: Create a Calculated Field
PivotCalculatedFieldCollection Interface