DifferenceCalculation Class
A difference calculation that is used to compute the difference between measure values across a window.
Namespace: DevExpress.DashboardCommon
Assembly: DevExpress.Dashboard.v22.1.Core.dll
Declaration
Remarks
To apply a calculation to values of the required measure, perform the following steps.
- Create the DifferenceCalculation class instance, initialize its settings and assign the resulting object to the Measure.Calculation property. As an alternative, you can create a calculation expression with the calculation functions and assign it to the (Measure.Expression property.
- Specify a window used to apply a calculation. To do this, create and initialize the descendant of the MeasureCalculationWindowDefinition class (choose the descendant related to the dashboard item type) and assign the resulting object to the Measure.WindowDefinition property.
Example
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);
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DifferenceCalculation class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.