Variation Types
- 3 minutes to read
Variation summary display types are designed to display absolute and percentage difference between the current value and the previously calculated value for the field. To employ variation summary display types, use DifferenceBinding in Optimized mode.
The following variation types are available:
Absolute Variation
The absolute variance between the current value and the previously calculated value for the current field is displayed in a cell.
Example
The following code snippet shows how to calculate the absolute variances for the Value field cells:
static void itemClickEventHandler(object sender, ItemClickEventArgs e) {
BarItem barItem = sender as BarItem;
object[] barItemInfo = (object[])barItem.Tag;
PivotGridField field = (PivotGridField)barItemInfo[0];
FieldSummaryDisplayType newValue = (FieldSummaryDisplayType)barItemInfo[2];
DataSourceColumnBinding sourceBinding = new DataSourceColumnBinding("Value");
switch(newValue){
case FieldSummaryDisplayType.AbsoluteVariation:
field.DataBinding = new DifferenceBinding(
sourceBinding,
CalculationPartitioningCriteria.RowValue,
CalculationDirection.DownThenAcross,
DifferenceTarget.Previous,
DifferenceType.Absolute);
break;
// ...
}
field.Tag = newValue;
(field.Parent as PivotGridControl).ReloadData();
}
Note
Set PivotGridField.SummaryDisplayType to AbsoluteVariation
in Legacy and LegacyOptimized modes.
Percent Variation
The percentage variance between the current value and the previously calculated value for the current field is displayed in a cell.
Example
The following code snippet shows how to calculate the percent variances for the Value field cells:
static void itemClickEventHandler(object sender, ItemClickEventArgs e) {
BarItem barItem = sender as BarItem;
object[] barItemInfo = (object[])barItem.Tag;
PivotGridField field = (PivotGridField)barItemInfo[0];
FieldSummaryDisplayType newValue = (FieldSummaryDisplayType)barItemInfo[2];
DataSourceColumnBinding sourceBinding = new DataSourceColumnBinding("Value");
switch(newValue){
// ...
case FieldSummaryDisplayType.PercentVariation:
field.DataBinding = new DifferenceBinding(
sourceBinding,
CalculationPartitioningCriteria.RowValue,
CalculationDirection.DownThenAcross,
DifferenceTarget.Previous,
DifferenceType.Percentage);
break;
// ...
}
field.Tag = newValue;
(field.Parent as PivotGridControl).ReloadData();
}
Note
Set PivotGridField.SummaryDisplayType to PercentVariation
in Legacy and LegacyOptimized modes.