# Aggregates

The TreeList enables you to display aggregated number results when the user groups its data.

To enable the aggregate functions, use the `DataSource.Aggregates()` and the `FooterTemplate()` methods of the TreeList, and the `aggregate` fields of its data source.

```Razor HtmlHelper
    @(Html.Kendo().TreeList<Kendo.Mvc.Examples.Models.TreeList.EmployeeDirectoryModel>()
        .Name("treelist")
        .Columns(columns =>
        {
            columns.Add().Field(e => e.Extension).Title("Ext")
            .FooterTemplate("Total: #= count #, Sum: #= sum #, Min: #= min #, Max: #= max #, Average: #= average #");
        })
        .DataSource(dataSource => dataSource
            .ServerOperation(false)
            .Read(read => read.Action("All", "EmployeeDirectory"))
            .Aggregates(aggr =>
            {
                aggr.Add(e => e.Extension).Count().Sum().Max().Min().Average();
            })
            .Model(m =>
            {
                m.Id(f => f.EmployeeId);
                m.ParentId(f => f.ReportsTo);
                m.Field(f => f.ReportsTo);
            })
        )
    )
```

For a runnable example, refer to the [demo on using aggregate functions in the TreeList](https://demos.telerik.com/aspnet-mvc/treelist/aggregates).

## See Also

* [Aggregates by the TreeList HtmlHelper for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/treelist/aggregates)
* [Server-Side API](https://www.telerik.com/aspnet-mvc/documentation/api/treelist)
