Totals (Subtotals)
- 2 minutes to read
Subtotals (also called Totals) can be calculated for each grouping item (a grouping column or grouping row) to represent the aggregate value for each data field within the category. Subtotals are linked with the corresponding grouping item and are treated as grouping values.
Row Subtotals (or Row Totals) are rows which display subtotals calculated for outer row fields. Column Subtotals (or Column Totals) are columns which display subtotals calculated for outer column fields.
The ExpressPivotGrid control supports automatic and custom totals. Automatic totals are calculated using a summary function which is specified by a corresponding data field. Custom totals can be calculated using any summary function. It’s possible to calculate multiple custom totals against a data field.
A column (or row) total consists of the Header and Total Values regions:
The table below lists the main properties which affect the appearance of subtotals.
Visibility | A field’s TotalsVisibility and CustomTotals properties and the pivot grid’s OptionsView.TotalsForSingleValues property. For column totals, the pivot grid’s OptionsView.ColumnTotals property. For row totals, the pivot grid’s OptionsView.RowTotals property. |
Cell Visibility | A field’s DataVisibility property. |
Custom Totals Availability | A field’s TotalsVisibility property. |
Custom Total Collection | A field’s CustomTotals property. |
Position | The pivot grid’s OptionsView.ColumnTotalsLocation, OptionsView.RowTotalsLocation, and OptionsView.TotalsLocation properties. |
Header:
Contents | A field’s OnGetGroupValueDisplayText event. |
Appearance | For totals and grand totals, the pivot grid’s Styles.Total property. For column totals, the pivot grid’s Styles.ColumnHeader property. For row totals, the pivot grid’s Styles.RowHeader property. To dynamically customize these style settings, handle the pivot grid’s Styles.OnGetColumnHeaderStyle and Styles.OnGetRowHeaderStyle events. Note These style settings do not modify an element’s background if the pivot grid is painted using the Windows XP (native) or Office2003 style. |
Custom Draw Event | For column totals, the pivot grid’s OnCustomDrawColumnHeader event. For row totals, the pivot grid’s OnCustomDrawRowHeader event. |
Context Menu | Refer to the Grouping Value Context Menu topic. |
Hints | The pivot grid’s OptionsBehavior.GroupHeaderHints property. The pivot grid’s OnGetCellHint event. |
HitTest Information | The HitTest.HitAtGroupHeader property. |
Total Values:
Contents | A field’s OnGetDisplayText event. |
Appearance | The pivot grid’s Styles.Content property. To dynamically customize these style settings, handle the pivot grid’s Styles.OnGetContentStyle event. |
Custom Draw Event | The pivot grid’s OnCustomDrawCell event. |
Hints | The pivot grid’s OptionsBehavior.CellHints property. The pivot grid’s OnGetCellHint event. |
HitTest Information | The HitTest.HitAtDataCell property. |