[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Collapse]Spreadsheet
    Product Structure
   [Expand]Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Shapes
    Printing
    Protection
    Find and Replace
   [Expand]Mail Merge
   [Expand]Visual Elements
    Services
    Themes and Templates
   [Expand]Shortcuts
   [Collapse]Examples
    [Expand]Files
    [Expand]Workbooks
    [Expand]Worksheet
    [Expand]Rows and Columns
    [Expand]Cells
    [Expand]Formulas
    [Expand]Data Binding
    [Expand]Formatting Cells
    [Expand]Conditional Formatting
    [Expand]Group Data
    [Expand]Filter Data
    [Expand]Tables
    [Collapse]Pivot Tables
      How to: Create a Pivot Table
      How to: Refresh a Pivot Table
      How to: Change a Data Source for a Pivot Table
      How to: Move a Pivot Table
      How to: Clear or Remove a Pivot Table
      How to: Change the PivotTable Layout
      How to: Subtotal Fields in a Pivot Table
      How to: Display or Hide Grand Totals for a Pivot Table
      How to: Apply a Predefined Style to a Pivot Table
      How to: Apply a Custom Style to a Pivot Table
      How to: Control Style Options
      How to: Change the Summary Function for a Data Field
      How to: Apply a Custom Calculation to a Data Field
      How to: Create a Calculated Field
      How to: Create a Calculated Item
      How to: Sort Items in a Pivot Table
      How to: Filter Items in a Pivot Table
      How to: Group Items in a Pivot Table
    [Expand]Printing
    [Expand]Pictures
    [Expand]Shapes
    [Expand]Charts
    [Expand]Sparklines
    [Expand]Protection
    [Expand]Mail Merge
    [Expand]Cell Templates
    [Expand]Commands
    [Expand]Customization
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Group Items in a Pivot Table

Grouping can help you to get a clearer view of data and show only data you want to analyze.

Expanded Group a Pivot Table by Date

Start with a raw data table that shows sales figures for a customer and a product on a certain date.

Create a pivot table that shows the total sum of all sales for each customer on each date.

To group the sales amount by month and quarter, perform the following steps.

  • Right click on left column of the pivot table (containing the dates) and select Group....
  • The Grouping dialog is invoked. Select Months and Quarters and click OK.

  • The result is shown in the picture below.

You can also group the pivot table in code, using the PivotField.GroupItems method with the combination of PivotFieldGroupByType.Quarters and PivotFieldGroupByType.Months values passed as a single parameter.

Expanded Group a Pivot Table by Range

Start with a raw data table that shows sales figures for a product.

Create a pivot table that shows the number of sales for each product.

To group the sales amounts by thousands, perform the following steps.

  • Right click on top row of the pivot table (containing the sales amounts) and select Group...
  • The Grouping dialog is invoked. Type in start value, end value, interval and click OK.

  • The result is shown in the picture below.

You can also group the pivot table in code, using the PivotField.GroupItems method with the PivotFieldGroupByType.NumericRanges parameter specifying the smallest and largest number to group the field and an interval for each group.

Expanded Group Selected Items

You can select specific items and group them.

In the pivot table shown at the picture below, select the first three items - Arizona, California and Colorado.

Right click and select Group.... Press F2 to change the name of the group from Group to West. Press Enter to finish. The result is as follows.

You can also group the pivot table in code, using the PivotField.GroupItems method with a list of item indices (0, 1, 2) passed as a parameter.

Expanded Ungroup Data

To ungroup the values in a pivot table, do the following.

  • Right click on the row or column of the pivot table containing the grouped values.
  • Select the option Ungroup....

To ungroup a grouped field in code, use the PivotField.UngroupItems method without parameters.

Use the PivotField.UngroupItems method with a name of the group as a parameter to ungroup only that group of items, as illustrated in the following code snippet.

Is this topic helpful?​​​​​​​