Back to Devexpress

DifferenceCalculation Class

dashboard-devexpress-dot-dashboardcommon-3a292f2c.md

latest5.1 KB
Original Source

DifferenceCalculation Class

A difference calculation that is used to compute the difference between measure values across a window.

Namespace : DevExpress.DashboardCommon

Assembly : DevExpress.Dashboard.v25.2.Core.dll

NuGet Package : DevExpress.Dashboard.Core

Declaration

csharp
public class DifferenceCalculation :
    BaseCalculation<DifferenceCalculation>
vb
Public Class DifferenceCalculation
    Inherits BaseCalculation(Of DifferenceCalculation)

Remarks

To apply a calculation to values of the required measure, perform the following steps.

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.

csharp
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);
}
vb
Imports DevExpress.DashboardCommon
Imports DevExpress.DashboardWin
' ...
Dim pivotItem As PivotDashboardItem = TryCast(dashboardViewer1.Dashboard.Items(pivotItemName), PivotDashboardItem)
If pivotItem IsNot Nothing Then
    Dim extendedPrice As New Measure("Extended Price") With { _
        .Name = "Diff", _
        .ShowGrandTotals = False _
    }
    Dim pivotWindowDefinition As New PivotWindowDefinition()
    pivotWindowDefinition.DefinitionMode = PivotWindowDefinitionMode.Columns
    extendedPrice.WindowDefinition = pivotWindowDefinition
    extendedPrice.Calculation = New DifferenceCalculation() With {.DifferenceType = DifferenceType.Absolute}
    pivotItem.Values.Add(extendedPrice)
End If

Inheritance

Object DevExpress.DashboardCommon.Native.ClonableModelBase<MeasureCalculation> MeasureCalculation DevExpress.DashboardCommon.Native.BaseCalculation<DifferenceCalculation> DifferenceCalculation

See Also

DifferenceCalculation Members

Window Calculations

Creating Window Calculations

DevExpress.DashboardCommon Namespace