Measure.Calculation Property
Gets or sets a calculation applied to values of the current measure.
Namespace: DevExpress.DashboardCommon
Assembly: DevExpress.Dashboard.v20.2.Core.dll
Declaration
[DefaultValue(null)]
public MeasureCalculation Calculation { get; set; }
<DefaultValue(Nothing)>
Public Property Calculation As MeasureCalculation
Property Value
Type | Default | Description |
---|---|---|
MeasureCalculation | null |
A MeasureCalculation descendant that specifies a calculation applied to values of the current measure. |
Remarks
To apply a calculation to values of the required measure, perform the following steps.
- Create the MeasureCalculation class instance, initialize its settings and assign the resulting object to the Measure.Calculation property. As an alternative, you can create a Measure.Expression with the calculation functions.
- Specify a window to apply a calculation. To do this, create and initialize the descendant of the MeasureCalculationWindowDefinition class (depending on the type of the dashboard item) and assign the resulting object to the WindowDefinition property.
Examples
The code snippet adds a new measure to the Pivot dashboard item and specifies a window calculation to compute the difference between measure values across a window. The calculation is performed along columns of the Pivot dashboard item.
using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
// ...
PivotDashboardItem pivotItem = dashboardViewer1.Dashboard.Items[pivotItemName] as PivotDashboardItem;
if (pivotItem != null)
{
Measure extendedPrice = new Measure("Extended Price")
{
Name = "Diff",
ShowGrandTotals = false
};
PivotWindowDefinition pivotWindowDefinition = new PivotWindowDefinition();
pivotWindowDefinition.DefinitionMode = PivotWindowDefinitionMode.Columns;
extendedPrice.WindowDefinition = pivotWindowDefinition;
extendedPrice.Calculation = new DifferenceCalculation() { DifferenceType = DifferenceType.Absolute };
pivotItem.Values.Add(extendedPrice);
}
See Also
Feedback