aspnet-devexpress-dot-web-dot-aspxpivotgrid-09590d71.md
Allows you to use an expression to evaluate values for a Pivot Grid’s field in OLAP mode.
Namespace : DevExpress.Web.ASPxPivotGrid
Assembly : DevExpress.Web.ASPxPivotGrid.v25.2.dll
NuGet Package : DevExpress.Web
public class OLAPExpressionBinding :
OLAPExpressionBindingBase
Public Class OLAPExpressionBinding
Inherits OLAPExpressionBindingBase
Calculated fields display the result of calculated expressions. You can use a formula or an aggregate function as a binding expression for each calculated field. The expression allows you to not only obtain values from a field in the data source, but also specify exactly how to calculate the data (for example, aggregate it).
Follow the steps below to create a calculated field in OLAP mode.
OLAPExpressionBinding instance and pass the expression to 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 the fieldSales field to the MDX expression:
using System;
using DevExpress.XtraPivotGrid;
using DevExpress.Web.ASPxPivotGrid;
//...
PivotGridField fieldSales = new PivotGridField();
fieldSales.Caption = "Cleared Amount";
fieldSales.Area = PivotArea.DataArea;
fieldSales.DataBinding = new OLAPExpressionBinding("[Measures].[Internet Sales Amount] * 0.87");
ASPxPivotGrid1.Fields.Add(fieldSales);
Imports System
Imports DevExpress.XtraPivotGrid
Imports DevExpress.Web.ASPxPivotGrid
'...
Private fieldSales As New PivotGridField()
fieldSales.Caption = "Cleared Amount"
fieldSales.Area = PivotArea.DataArea
fieldSales.DataBinding = New OLAPExpressionBinding("[Measures].[Internet Sales Amount] * 0.87")
ASPxPivotGrid1.Fields.Add(fieldSales)
Note
Use ExpressionDataBinding in Server and Optimized modes.
DevExpress.XtraPivotGrid.IDesignerContextProvider
Object DataBindingBase OLAPExpressionBindingBase OLAPExpressionBinding
See Also