Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Display or Hide Grand Totals for a Pivot Table

  • 2 minutes to read

To control how grand totals are displayed in a pivot table, use the following properties.

Property Description
PivotLayout.ShowRowGrandTotals Specifies whether to display a grand total column.
PivotLayout.ShowColumnGrandTotals Specifies whether to display a grand total row.
PivotViewOptions.GrandTotalCaption Specifies the text label for both the grand total column and grand total row.

#Hide Grand Totals for Rows

View Example

Worksheet worksheet = workbook.Worksheets["Report1"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Add the "Region" field to the column axis area. 
pivotTable.ColumnFields.Add(pivotTable.Fields["Region"]);

// Hide grand totals for rows.
pivotTable.Layout.ShowRowGrandTotals = false;

The image below shows the resulting PivotTable report (the workbook is opened in Microsoft® Excel®).

Spreadsheet_PivotTable_HideGrandTotalColumn

#Hide Grand Totals for Columns

View Example

Worksheet worksheet = workbook.Worksheets["Report1"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Add the "Region" field to the column axis area. 
pivotTable.ColumnFields.Add(pivotTable.Fields["Region"]);

// Hide grand totals for columns.
pivotTable.Layout.ShowColumnGrandTotals = false;

The image below shows the resulting PivotTable report (the workbook is opened in Microsoft® Excel®).

Spreadsheet_PivotTable_HideGrandTotalRow