Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
  [Expand]Reporting
  [Expand]Chart Control
  [Expand]Grid View
  [Expand]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Site Navigation and Layout
  [Expand]File Management
  [Expand]Multi-Use Site Controls
  [Expand]Scheduler
  [Expand]HTML Editor
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Binding to Data
   [Collapse]Data Shaping
    [Expand]Aggregation
     Grouping
    [Expand]Sorting
    [Expand]Filtering
   [Expand]Data Analysis
   [Expand]Data Formatting
   [Expand]Layout
   [Expand]Appearance
   [Expand]Data Export
   [Expand]Design-Time Features
   [Expand]UI Elements
   [Expand]Examples
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Gauges
  [Expand]Data Editors
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Grouping

By default, all unique field values of column and row fields are listed along the pivot grid's top and left edges. These values represent headers of the columns and rows - the report's axes.

The Pivot Grid provides the grouping feature, allowing field values to be grouped into categories (ranges). This is useful for representing date/time and numeric data. For instance, values of a column or row field which displays date/time data, can be grouped by years, months, quarters, etc. Numeric values can be grouped into numeric ranges. String values can be grouped by the starting characters.

The following image shows two ASPxPivotGrid controls. The first control displays the original data before it's grouped. The second control groups values of the 'Order Date' column field by years.

To specify the grouping mode, use the field's PivotGridFieldBase.GroupInterval property. If the field contains numeric values, use the PivotGridFieldBase.GroupIntervalNumericRange property to specify the length of the intervals. For instance, if this property is set to 10, the values are arranged into the following intervals: 0-9, 10-19, 20-29, etc.

Multiple fields in the ASPxPivotGrid control can be bound to the same field in the underlying data source. The values of these fields can be grouped independently. For instance, it's possible to create two fields and bind them to the 'OrderDate' field in the data source. The first field can group data by years, the second field - by quarters, as shown in the image below:

If you want to group field values using a custom rule, handle the ASPxPivotGrid.CustomGroupInterval event and implement the required grouping algorithm.

Expanded Example: How to Group Date-Time Values

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E1875.

Assume that the ASPxPivotGrid control is bound to a data table that contains an 'OrderDate' field. In the following example, two PivotGridField fields are created and displayed in the Column Header Area, each of them bound to the 'OrderDate' field. The first pivot grid field's values will be grouped by years, the second field's values will be grouped by months. To group data, the PivotGridFieldBase.GroupInterval property is used.

How would you rate this topic?​​​​​​​