Summaries
Introduction
You may render a "summary" section below your table content. This is great for displaying the results of calculations such as averages, sums, counts, and ranges of the data in your table.
By default, there will be a single summary line for the current page of data, and an additional summary line for the totals for all data if multiple pages are available. You may also add summaries for groups of records, see "Summarising groups of rows".
"Summarizer" objects can be added to any table column using the summarize()
method:
use Filament\Tables\Columns\Summarizers\Average;
use Filament\Tables\Columns\TextColumn;
TextColumn::make('rating')
->summarize(Average::make())
Multiple "summarizers" may be added to the same column:
use Filament\Tables\Columns\Summarizers\Average;
use Filament\Tables\Columns\Summarizers\Range;
use Filament\Tables\Columns\TextColumn;
TextColumn::make('rating')
->numeric()
->summarize([
Average::make(),
Range::make(),
])
The first column in a table may not use summarizers. That column is used to render the heading and subheading/s of the summary section.
