Skip to main content

Percentage Types

  • 6 minutes to read

Percentage summary display types are designed to show cell values as a percentage of the Total and Grand Total values in data cells. To employ these types, use PercentOfTotalBinding in Optimized mode.

Note

Percentage summary display types automatically format values as percentages. To specify custom formatting settings for a data field, use its PivotGridFieldBase.CellFormat property.

The following percentage types are available:

Percent of Column

The percentage of the Column Total value is displayed in a cell.

SummaryDisplayType_PercentOfColumn

Cell values are calculated as follows:

Column Calculation Description
Chai – September – PercentOfColumn 0.4935 = 518.4/ 1050.4 518.4 is the actual sum calculated against the Product Sales field for the Chai – September cell, and 1050.4 is the Total value calculated for this column (Beverages – September).
Beverages Total – September – PercentOfColumn 0.814 = 1050.4/ 1290.4 1050.4 is the Total value calculated for the Beverages – September column against the Product Sales field, and 1290.4 is the Grand Total value calculated for this column (September).

Example

View Example: Pivot Grid for WinForms - How to Change SummaryDisplayType in the Context Menu

The following code snippet shows how to calculate the percentage of column total for the Number field:

void ItemClick(object sender, EventArgs e) {
// ...
    PivotGridField field = item.Tag as PivotGridField;
    DataSourceColumnBinding sourceBinding = new DataSourceColumnBinding("Number");
    PivotSummaryDisplayType newValue = (PivotSummaryDisplayType)Enum.Parse(typeof(PivotSummaryDisplayType), 
       item.Caption);
    switch(newValue) {
    // ...
        case PivotSummaryDisplayType.PercentOfColumn:
            field.DataBinding = new PercentOfTotalBinding(
                sourceBinding,
                CalculationPartitioningCriteria.ColumnValueAndRowParentValue);
            break;
    // ...      
    }
    field.Tag = newValue;
}

Note

Set PivotGridFieldBase.SummaryDisplayType to PercentOfColumn in Legacy, LegacyOptimized, and OLAP modes.

Percent of Column Grand Total

The percentage of the Column Grand Total value is displayed in a cell.

SummaryDisplayType_PercentOfColumnGrandTotal

For instance, the Chai – September – PercentOfColumnGrandTotal cell value is calculated as follows:

0.4017 = 518.4/1290.4

518.4 is the actual sum calculated against the Product Sales field for the Chai – September cell, and 1290.4 is the Grand Total value calculated for this column (September).

Example

View Example: Pivot Grid for WinForms - How to Change SummaryDisplayType in the Context Menu

The following code snippet shows how to calculate the percentage of column grand total for the Number field:

void ItemClick(object sender, EventArgs e) {
// ...
    PivotGridField field = item.Tag as PivotGridField;
    DataSourceColumnBinding sourceBinding = new DataSourceColumnBinding("Number");
    PivotSummaryDisplayType newValue = (PivotSummaryDisplayType)Enum.Parse(typeof(PivotSummaryDisplayType), 
       item.Caption);
    switch(newValue) {
    // ...
       case PivotSummaryDisplayType.PercentOfColumnGrandTotal:
           field.DataBinding = new PercentOfTotalBinding(
               sourceBinding,
               CalculationPartitioningCriteria.ColumnValue);
           break;
    // ...      
    }
    field.Tag = newValue;
}

Note

Set PivotGridFieldBase.SummaryDisplayType to PercentOfColumnGrandTotal in Legacy, LegacyOptimized, and OLAP modes.

Percent of Row

The percentage of the Row Total value is displayed in a cell.

SummaryDisplayType_PercentOfRow

Cell values are calculated as follows:

Row Calculation Description
Beverages – August 1994 – PercentOfRow 0.3228 = 2226.9/ 6898.58 2226.9 is the actual sum calculated against the Product Sales field for the Beverages – August 1994 cell, and 6898.58 is the Total value calculated for this row (Beverages – 1994 Total).
Beverages – 1994 Total – PercentOfRow 0.3377 = 6898.58/ 20426.1 6898.58 is the Total value calculated for the Beverages – 1994 row against the Product Sales field, and 20426.1 is the Grand Total value calculated for this row (Beverages).

Example

View Example: Pivot Grid for WinForms - How to Change SummaryDisplayType in the Context Menu

The following code snippet shows how to calculate the percentage of row total for the Number field:

void ItemClick(object sender, EventArgs e) {
// ...
    PivotGridField field = item.Tag as PivotGridField;
    DataSourceColumnBinding sourceBinding = new DataSourceColumnBinding("Number");
    PivotSummaryDisplayType newValue = (PivotSummaryDisplayType)Enum.Parse(typeof(PivotSummaryDisplayType), 
       item.Caption);
    switch(newValue) {
    // ...
       case PivotSummaryDisplayType.PercentOfRow:
           field.DataBinding = new PercentOfTotalBinding(
               sourceBinding,
               CalculationPartitioningCriteria.RowValueAndColumnParentValue);
           break;
    // ...      
    }
    field.Tag = newValue;
}

Note

Set PivotGridFieldBase.SummaryDisplayType to PercentOfRow in Legacy, LegacyOptimized, and OLAP modes.

Percent of Row Grand Total

The percentage of the Row Grand Total value is displayed in a cell.

SummaryDisplayType_PercentOfRowGrandTotal

For instance, the Beverages – August 1994 – PercentOfRowGrandTotal cell value is calculated as follows:

0.109 = 2226.9/20426.1

2226.9 is the actual sum calculated against the Product Sales field for the Beverages – August 1994 cell, and 20426.1 is the Grand Total value calculated for this row (Beverages).

Example

View Example: Pivot Grid for WinForms - How to Change SummaryDisplayType in the Context Menu

The following code snippet shows how to calculate the percentage of row total for the Number field:

void ItemClick(object sender, EventArgs e) {
// ...
    PivotGridField field = item.Tag as PivotGridField;
    DataSourceColumnBinding sourceBinding = new DataSourceColumnBinding("Number");
    PivotSummaryDisplayType newValue = (PivotSummaryDisplayType)Enum.Parse(typeof(PivotSummaryDisplayType), 
       item.Caption);
    switch(newValue) {
    // ...
       case PivotSummaryDisplayType.PercentOfRowGrandTotal:
           field.DataBinding = new PercentOfTotalBinding(
               sourceBinding,
               CalculationPartitioningCriteria.RowValue);
           break;
    // ...      
    }
    field.Tag = newValue;
}

Note

Set PivotGridFieldBase.SummaryDisplayType to PercentOfRowGrandTotal in Legacy, LegacyOptimized, and OLAP modes.

Percent of Grand Total

The percentage of the Grand Total value is displayed in a cell.

SummaryDisplayType_PercentOfGrandTotal

For instance, the Chai – September – PercentOfGrandTotal cell value is calculated as follows:

0.1595 = 518.4/3249.6

518.4 is the actual sum calculated against the Product Sales field for the Chai – September cell, and 3249.6 is the Grand Total value calculated against all data cells.

Example

View Example: Pivot Grid for WinForms - How to Change SummaryDisplayType in the Context Menu

The following code snippet shows how to calculate the percentage of grand total for the Number field:

void ItemClick(object sender, EventArgs e) {
// ...
    PivotGridField field = item.Tag as PivotGridField;
    DataSourceColumnBinding sourceBinding = new DataSourceColumnBinding("Number");
    PivotSummaryDisplayType newValue = (PivotSummaryDisplayType)Enum.Parse(typeof(PivotSummaryDisplayType), 
       item.Caption);
    switch(newValue) {
    // ...
       case PivotSummaryDisplayType.PercentOfGrandTotal:
           field.DataBinding = new PercentOfTotalBinding(
               sourceBinding,
               CalculationPartitioningCriteria.None);
           break;
    // ...      
    }
    field.Tag = newValue;
}

Note

Set PivotGridFieldBase.SummaryDisplayType to PercentOfGrandTotal in Legacy, LegacyOptimized, and OLAP modes.

See Also