Summarizing data is one of the most important features of the grid where you can easily group the similar data and calculate various types of aggregates such as Sum, Average, Count, Max, Min, and more.
In FlexGrid, you can easily summarize data by using SubTotal method of the C1FlexGrid class. It adds subtotal rows that contain aggregate data for the regular (non-subtotal) rows and also supports the hierarchical aggregates. The method has various overloads which gives you enough flexibility to deal with multiple summarizing related scenarios. All these overloads have one parameter in common, that is AggregateEnum which lets you set the type of aggregate you want to implement. Other parameters in various overloads let you set the outline level, start and end column, and column that contains values to be aggregated.
Below example demonstrates the use of SubTotal method in the WinForms FlexGrid for calculation of average aggregate based on Score column:
When the Subtotal method adds the rows with the aggregate information, it automatically assigns in-built subtotal styles to the new rows. You can customize the appearance of the subtotal rows by changing the properties of the outline styles in the designer with the Style Editor or using the code. Below example demonstrates styling of subtotals at three levels in the WinForms FlexGrid.
FlexGrid, in addition to built-in aggregate options, lets you create custom expressions in bound mode and use them as subtotals in groups along with aggregates. You can specify the custom expressions for a column using GroupExpression property of the Column class. Below example demonstrates how to create a custom expression as a subtotal for Qualified column of the WinForms FlexGrid.