windowsforms-devexpress-dot-xtrapivotgrid-a1bc8db2.md
Gets or sets an expression that is used to evaluate values for a Pivot Grid’s field in OLAP mode.
Namespace : DevExpress.XtraPivotGrid
Assembly : DevExpress.XtraPivotGrid.v25.2.dll
NuGet Package : DevExpress.Win.PivotGrid
public class OLAPExpressionBinding :
OLAPExpressionBindingBase
Public Class OLAPExpressionBinding
Inherits OLAPExpressionBindingBase
Pivot Grid allows you to create calculated fields. They do not obtain their values from fields in the data source. Instead, you specify a binding expression. The expression can be a formula or an aggregate function. You can use OLAPExpressionBinding to create a calculated field in OLAP mode.
Note
Use ExpressionDataBinding for Optimized and Server modes.
Follow the steps below to create a calculated field in OLAP mode:
OLAPExpressionBinding instance and pass the expression in its constructor as a parameter. You can also use the object’s OLAPExpressionBindingBase.Expression property to specify the expression.The following code snippet shows how to bind measureField to the MDX expression:
PivotGridField measureField = new PivotGridField() { Caption = "Cleared Amount",
Area = PivotArea.DataArea };
measureField.DataBinding = new OLAPExpressionBinding("[Measures].[Internet Sales Amount] * 0.87");
measureField.Name = "fieldInternetSalesAmount";
pivotGridControl1.Fields.Add(measureField);
Dim measureField As PivotGridField = New PivotGridField() With {.Caption = "Cleared Amount", .Area = PivotArea.DataArea}
measureField.DataBinding = New OLAPExpressionBinding("[Measures].[Internet Sales Amount] * 0.87")
measureField.Name = "fieldInternetSalesAmount"
pivotGridControl1.Fields.Add(measureField)
Refer to the following article for more information: Calculated Fields.
Object DataBindingBase OLAPExpressionBindingBase OLAPExpressionBinding
See Also
Bind Pivot Grid Fields to Calculated Expressions
Bind Pivot Grid Fields to Data Columns
Bind Pivot Grid Fields to Data Columns
Bind Pivot Grid Fields to Calculated Expressions