DataGrid / Aggregates / Default Aggregate

Blazor DataGrid Example - Default Aggregation

Loading Syncfusion Blazor Server Demos…

This sample demonstrates the DataGrid's built-in aggregate functionality by displaying footer aggregate values in the Freight column.

Aggregates in the Blazor DataGrid are displayed in the footer, group footer, and group caption sections. The GridAggregates component provides configuration options for defining aggregate behavior.

The built-in aggregate types supported are:

  • Sum - Calculates the total sum of values
  • Average - Calculates the average value
  • Min - Identifies the minimum value
  • Max - Identifies the maximum value
  • Count - Counts total records
  • TrueCount - Counts boolean true values
  • FalseCount - Counts boolean false values

In this demo, the FooterTemplate displays multiple aggregates in the DataGrid footer:

  • The Sum aggregate is displayed in the Freight column's first aggregate row. Configure this by setting the Type and Field properties to Freight. Within the FooterTemplate, access the sum value via SumValue.Sum, where SumValue is the implicit Context parameter. The value is formatted using the Format property (C2).

  • The Average aggregate is displayed in the Freight column's second aggregate row. Set the Type and Field properties to Freight. Access the aggregate value via AverageValue.Average, where AverageValue is the implicit Context parameter. The value is formatted according to the Format property value (C2).

For more detailed information about aggregates, refer to the aggregates documentation.

Transform your Blazor web apps today with Syncfusion® Blazor components
145+ high-performance and responsive UI components
Dedicated support
Hassle-free licensing
TRY IT FOR FREE