Filament v3 Table Summarizers: Totals &amp; Custom Aggregates | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.msaied.com) [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles  ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

  [ home ](https://www.msaied.com)    [ articles ](https://www.msaied.com/articles)    Filament v3 Table Column Summarizers: Totals, Averages, and Custom Aggregates        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)

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

  #filament   #laravel   #php   #admin-panel  

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

     14 Jun 2026      3 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   Why Summarizers Matter in Admin Panels  ](#why-summarizers-matter-in-admin-panels)
2. [  02   Built-in Summarizers  ](#built-in-summarizers)
3. [  03   Scoping a Summarizer to a Subset  ](#scoping-a-summarizer-to-a-subset)
4. [  04   Building a Custom Summarizer  ](#building-a-custom-summarizer)
5. [  05   Formatting the Output  ](#formatting-the-output)
6. [  06   Summarizers in Grouped Tables  ](#summarizers-in-grouped-tables)
7. [  07   Performance Notes  ](#performance-notes)
8. [  08   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.

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Ffilament-v3-table-column-summarizers-totals-averages-and-custom-aggregates&text=Filament+v3+Table+Column+Summarizers%3A+Totals%2C+Averages%2C+and+Custom+Aggregates) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Ffilament-v3-table-column-summarizers-totals-averages-and-custom-aggregates) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  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. 

      Q02  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. 

      Q03  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. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://www.msaied.com/articles) 

 [ ![Pest Architecture Tests: Enforcing Clean Boundaries in Laravel Without a CI Nanny](https://cdn.msaied.com/166/2747407f8fcc1af6734aa1b0565dc371.png) pest laravel testing 

### Pest Architecture Tests: Enforcing Clean Boundaries in Laravel Without a CI Nanny

Pest's architecture testing API lets you encode structural rules directly in your test suite, catching layer v...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 14 Jun 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/pest-architecture-tests-enforcing-clean-boundaries-in-laravel-without-a-ci-nanny) [ ![Filament v3 Global Search: Custom Result Providers and Scoped Tenant Isolation](https://cdn.msaied.com/165/4de273593ea2005169698edc5cc53d6b.png) filament laravel multi-tenant 

### Filament v3 Global Search: Custom Result Providers and Scoped Tenant Isolation

Learn how to register custom global search providers in Filament v3, scope results to the current tenant, and...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 14 Jun 2026     1 min read  

  Read    

 ](https://www.msaied.com/articles/filament-v3-global-search-custom-result-providers-and-scoped-tenant-isolation) [ ![Semantic Search in Laravel with pgvector and OpenAI Embeddings](https://cdn.msaied.com/163/c88461e4a878f0ca8939e20d5d4b12dd.png) laravel postgresql pgvector 

### Semantic Search in Laravel with pgvector and OpenAI Embeddings

Learn how to add production-ready semantic search to a Laravel app using PostgreSQL's pgvector extension and O...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 14 Jun 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/semantic-search-in-laravel-with-pgvector-and-openai-embeddings) 

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

Explore

- [Home](https://www.msaied.com)
- [Projects](https://www.msaied.com/projects)
- [Articles](https://www.msaied.com/articles)
- [Certificates](https://www.msaied.com/certificates)
- [Contact](https://www.msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
