Skip to main content

PivotGridFieldSortBySummaryInfo Class

Contains the settings used to sort the values of a column field or row field by summary values in another row/column.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.PivotGrid.v23.1.Core.dll

NuGet Packages: DevExpress.PivotGrid.Core, DevExpress.Win.Dashboard.Design


public class PivotGridFieldSortBySummaryInfo :

The following members return PivotGridFieldSortBySummaryInfo objects:

Library Related API Members
Cross-Platform Class Library PivotGridFieldBase.SortBySummaryInfo
ASP.NET Web Forms Controls PivotGridField.SortBySummaryInfo


By default the field values of a column field or row field are arranged in alphabetical order (for text data) or in order of magnitude (for numeric and date/time data). In certain cases it may be necessary to sort the field values according to the summary values in other rows/columns (for instance, according to the grand totals calculated against a specific data field). This functionality is provided by the PivotGridFieldBase.SortBySummaryInfo property which represents an instance of the PivotGridFieldSortBySummaryInfo class.

The field values of column/row fields are arranged in ascending or descending order depending upon the PivotGridFieldBase.SortOrder property’s value.

It’s possible to use the PivotGridFieldSortBySummaryInfo.Field or PivotGridFieldSortBySummaryInfo.FieldName property to specify the field against which a specific summary will be calculated and the summary values will determine the order in which the field values of the column/row field will be arranged.

The PivotGridFieldSortBySummaryInfo.Field property must be set to null for the PivotGridFieldSortBySummaryInfo.FieldName property to be in effect.

Using the PivotGridFieldSortBySummaryInfo.FieldName property has two advantages:

  1. The PivotGridFieldSortBySummaryInfo.FieldName property can be set to any field name in the control’s data source (even to a field name which has no bound PivotGridField object in the XtraPivotGrid control).

  2. It’s possible to specify any summary function type which will be calculated against the field. In the case of using the PivotGridFieldSortBySummaryInfo.Field property, the summary function type is determined by PivotGridFieldBase.SummaryType property of the PivotGridFieldSortBySummaryInfo.Field object.

If you specify only the PivotGridFieldSortBySummaryInfo.Field (PivotGridFieldSortBySummaryInfo.FieldName) property, values of the current field will be sorted by grand total values calculated against this PivotGridFieldSortBySummaryInfo.Field (or field referred to by the PivotGridFieldSortBySummaryInfo.FieldName property). However, a row field’s values can be sorted by summary values in any PivotGrid column. Similarly, a column field’s values can be sorted by summary values in any PivotGrid row. To do this, you need to identify the PivotGrid column/row against which data is sorted. To identify the PivotGrid column/row, in addition to specifying the PivotGridFieldSortBySummaryInfo.Field (PivotGridFieldSortBySummaryInfo.FieldName) property, you need to add items to the PivotGridFieldSortBySummaryInfo.Conditions collection. Each item should identify a field and its value, and so the set of items will identify the target PivotGrid column/row.

See How to: Sort Data by Columns (Rows) in Code, for an example.

For end-users, sorting a column/row field’s values by other rows/columns is available via context menus, invoked when right-clicking an innermost column or row header.


In this example, selecting the “Sort ‘Product Name’ by This Column” option sorts values of the Product Name field by values in the clicked column:



You cannot use the CalculationBindingBase descendants to apply sorting by summary when Pivot Grid operates with Optimized calculation engine.

Refer to the following example for information on how to use a hidden field to sort the visible field values when Pivot Grid operates in Optimized mode:

View Example: How to Use a Hidden Field to Sort the Visible Field


See Also