wpf-devexpress-dot-xpf-dot-pivotgrid-dot-pivotgridfield-ed8ecec0.md
Gets or sets an expression used to evaluate values for the current unbound field in OLAP. This is a dependency property.
Namespace : DevExpress.Xpf.PivotGrid
Assembly : DevExpress.Xpf.PivotGrid.v25.2.dll
NuGet Package : DevExpress.Wpf.PivotGrid
public string OlapExpression { get; set; }
Public Property OlapExpression As String
| Type | Description |
|---|---|
| String |
A string that represents an expression used to evaluate values for the current field in OLAP.
|
The code below shows how to set an unbound expression for OLAP:
using DevExpress.Xpf.PivotGrid;
public MainWindow() {
// ...
var fieldPriceWithDiscount= new PivotGridField() { Caption = "Price with Discount", Area = FieldArea.DataArea };
fieldPriceWithDiscount.OlapExpression = "[Measures].[Internet Standard Product Cost] * 0.9";
pivotGridControl1.Fields.Add(fieldPriceWithDiscount);
}
Imports DevExpress.Xpf.PivotGrid
Public Sub New()
' ...
Dim fieldPriceWithDiscount As New PivotGridField() With {.Caption = "Price with Discount", .Area = FieldArea.DataArea}
fieldPriceWithDiscount.OlapExpression = "[Measures].[Internet Standard Product Cost] * 0.9";
pivotGridControl1.Fields.Add(fieldPriceWithDiscount)
End Sub
The same unbound expression in XAML:
<dxpg:x:Name="fieldPriceWithDiscount" Caption="Price with Discount" Area="DataArea" AreaIndex="1"
OlapExpression="[Measures].[Internet Standard Product Cost] * 0.9" />
Use the PivotGridField.UnboundExpression property to get or set an unbound expression for regular data sources.
To learn more about unbound fields, see Unbound Fields.
See Also
Bind Pivot Grid Fields to Calculated Expressions