© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
ddoddsr

How do we get getTableContentFooter() to work with calculated fields?

I followed the trick for Aggregate Data in Table Footer https://filamentphp.com/tricks/aggregate-data-in-table-footer and it worked nicely to sum a field.
But it does not recognize the calculated field.

I tried it with the ID field and it works to sum the ids in the footer (Just a test you know.)

When I made a calculated field from
id
id
with
TextColumn::make('id_test')  ->getStateUsing(function(Schedule $record) {
            return $record->id;
    }),
TextColumn::make('id_test')  ->getStateUsing(function(Schedule $record) {
            return $record->id;
    }),

it returns the id on each line but it will not sum in the footer rather displays a 0.

My real data is minutes in a schedule but the ID example is easy to follow...
Filament
Aggregate data in table footer (sum, avg...etc) by moaaz faracheh -...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
Solution
I think I'll start with the footer, the two values are strings of time that I need to carbon->diffInMinutes resulting in minutes to be summed then formatted as HH:MM
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to format dependable, readonly(calculated) fields?
FilamentFFilament / ❓┊help
3y ago
Table columns footer not being calculated using getTableContentFooter()
FilamentFFilament / ❓┊help
3y ago
How do form fields with relationships work?
FilamentFFilament / ❓┊help
2y ago
How do we get the fields relationship value in visible?
FilamentFFilament / ❓┊help
3y ago