Filament v3 Table Summarizers: Totals &amp; Custom Aggregates | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. Filament v3 Table Column Summarizers: Totals, Averages, and Custom Aggregates

 Filament v3 Table Column Summarizers: Totals, Averages, and Custom Aggregates
==============================================================================

 Filament v3 ships with built-in column summarizers that render totals and averages in your table footer — here's how to use them properly and build a custom one from scratch.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 14 Jun 2026 · Updated 14 Jun 2026 · 3 min read

ShareCopy linkCopied

 ![Filament v3 Table Column Summarizers: Totals, Averages, and Custom Aggregates](https://cdn.msaied.com/164/906904262a1af23fbdd05d06c9c83f5f.png) 

  On this page +1. [Why Summarizers Matter in Admin Panels](#why-summarizers-matter-in-admin-panels)
2. [Built-in Summarizers](#built-in-summarizers)
3. [Scoping a Summarizer to a Subset](#scoping-a-summarizer-to-a-subset)
4. [Building a Custom Summarizer](#building-a-custom-summarizer)
5. [Formatting the Output](#formatting-the-output)
6. [Summarizers in Grouped Tables](#summarizers-in-grouped-tables)
7. [Performance Notes](#performance-notes)
8. [Takeaways](#takeaways)

 Why Summarizers Matter in Admin Panels
--------------------------------------

Most Filament tables display rows. Summarizers display *meaning* — a running total of invoice amounts, an average order value, a count of flagged records. Without them, users export to a spreadsheet just to sum a column. Filament v3 solves this natively.

Built-in Summarizers
--------------------

Filament ships four summarizers out of the box: `Sum`, `Average`, `Count`, and `Range`. Attach them to any column via the `summarize()` method.

```php
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\Summarizers\Sum;
use Filament\Tables\Columns\Summarizers\Average;

TextColumn::make('amount')
    ->money('usd')
    ->summarize([
        Sum::make()->label('Total'),
        Average::make()->label('Avg'),
    ]),

```

Filament runs a single aggregate query per summarizer — not one per row — so this is safe on large datasets.

### Scoping a Summarizer to a Subset

Sometimes you want the sum only for *paid* invoices while still showing all rows. Use `->query()` on the summarizer:

```php
Sum::make()
    ->label('Paid Total')
    ->query(fn ($query) => $query->where('status', 'paid')),

```

The scoped query runs independently of the table's own filters, giving you a stable aggregate even when the user applies their own search.

Building a Custom Summarizer
----------------------------

The built-ins cover 80 % of cases. For the rest, extend `Summarizer` directly.

**Use case:** display the median of a numeric column. SQL has no universal `MEDIAN()`, so we'll pull the sorted values and compute it in PHP — acceptable for admin panels where the result set is bounded.

```php
namespace App\Filament\Summarizers;

use Filament\Tables\Columns\Summarizers\Summarizer;
use Illuminate\Database\Query\Builder;

class Median extends Summarizer
{
    public function getState(Builder $query): mixed
    {
        $values = $query
            ->orderBy($this->getColumn()->getName())
            ->pluck($this->getColumn()->getName())
            ->values();

        $count = $values->count();

        if ($count === 0) {
            return null;
        }

        $mid = (int) floor($count / 2);

        return $count % 2 === 0
            ? ($values[$mid - 1] + $values[$mid]) / 2
            : $values[$mid];
    }
}

```

Attach it like any built-in:

```php
use App\Filament\Summarizers\Median;

TextColumn::make('response_time_ms')
    ->summarize(Median::make()->label('Median ms')),

```

### Formatting the Output

Summarizers inherit `->formatStateUsing()`, so you can format without touching the column itself:

```php
Median::make()
    ->label('Median ms')
    ->formatStateUsing(fn ($state) => $state ? number_format($state, 1).' ms' : '—'),

```

Summarizers in Grouped Tables
-----------------------------

When you enable row grouping (`->groups()`), Filament renders summarizers *per group* as well as in the global footer. No extra configuration needed — it just works, because each group exposes its own scoped query builder to the summarizer.

```php
->groups([
    Group::make('status')->label('Status'),
])

```

You'll see a subtotal row under each status group and a grand total at the bottom. This is one of the most underused features in Filament v3.

Performance Notes
-----------------

- Each summarizer fires **one additional query** against the base Eloquent builder, not the paginated result.
- Scoped summarizers (`.query()`) fire their own separate query.
- For very large tables (millions of rows), push aggregates to a materialized view or a scheduled cache and return the cached value from `getState()`.

Takeaways
---------

- `Sum`, `Average`, `Count`, and `Range` cover most admin needs with zero boilerplate.
- Scoped summarizers let you show stable aggregates independent of user-applied filters.
- Custom summarizers require only one method — `getState(Builder $query)` — making them trivial to write.
- Grouped tables get per-group subtotals automatically.
- For huge datasets, cache the aggregate and return it from a custom summarizer to avoid slow footer queries.

- [filament](https://www.msaied.com/public/articles?search=filament)
- [laravel](https://www.msaied.com/public/articles?search=laravel)
- [php](https://www.msaied.com/public/articles?search=php)
- [admin-panel](https://www.msaied.com/public/articles?search=admin-panel)

 Frequently asked questions 
---------------------------

  Do Filament summarizers run a query per row?No. Each summarizer runs a single aggregate query against the base builder, regardless of how many rows are displayed. Scoped summarizers add one additional query each.

   Can I use a summarizer only on a specific group in a grouped table?Filament automatically scopes summarizers to each group when row grouping is enabled. You cannot easily exclude a specific group without overriding getState() in a custom summarizer and filtering by group key manually.

   How do I handle summarizers on very large tables without slow queries?Build a custom summarizer that returns a cached value — computed by a scheduled job or stored in a materialized view — instead of running a live aggregate query on every page load.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

[Mohamed Said](https://www.msaied.com/public#person)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleSemantic Search in Laravel with pgvector and OpenAI Embeddings](https://www.msaied.com/public/articles/semantic-search-in-laravel-with-pgvector-and-openai-embeddings) [Next articleFilament v3 Global Search: Custom Result Providers and Scoped Tenant Isolation](https://www.msaied.com/public/articles/filament-v3-global-search-custom-result-providers-and-scoped-tenant-isolation)  

   On this page
-------------

1. [Why Summarizers Matter in Admin Panels](#why-summarizers-matter-in-admin-panels)
2. [Built-in Summarizers](#built-in-summarizers)
3. [Scoping a Summarizer to a Subset](#scoping-a-summarizer-to-a-subset)
4. [Building a Custom Summarizer](#building-a-custom-summarizer)
5. [Formatting the Output](#formatting-the-output)
6. [Summarizers in Grouped Tables](#summarizers-in-grouped-tables)
7. [Performance Notes](#performance-notes)
8. [Takeaways](#takeaways)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/743/8998fac3a41451ab3fe1588194e17a43.png) Filament · 3 min read### Securing Filament Plugins with Plumb: Automated Security Scoring for PHP Packages

5 Oct 2026 ](https://www.msaied.com/public/articles/securing-filament-plugins-with-plumb-automated-security-scoring-for-php-packages) [ ![](https://cdn.msaied.com/742/2d02018669cdeedccb5de2efb898f0ee.png) Filament · 3 min read### Filament v3.3.56 Released: File Hash Names and Livewire Upload Fix

5 Oct 2026 ](https://www.msaied.com/public/articles/filament-v3356-released-file-hash-names-and-livewire-upload-fix) [ ![](https://cdn.msaied.com/741/5b55c123ad08e4d34e1f4b99ad6a428b.png)  · 3 min read### Filament v4 Schema-Based Forms, Infolists, and the Unified Schema API

5 Oct 2026 ](https://www.msaied.com/public/articles/filament-v4-schema-based-forms-infolists-and-the-unified-schema-api-5) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
