Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

OLAPExpressionBinding Class

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.v24.2.dll

NuGet Package: DevExpress.Win.PivotGrid

#Declaration

public class OLAPExpressionBinding :
    OLAPExpressionBindingBase

#Remarks

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:

  1. Create an 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.
  2. Assign the created object to the PivotGridFieldBase.DataBinding property.

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);

View Example

Refer to the following article for more information: Calculated Fields.

#Inheritance

See Also