© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
13 replies
ddoddsr

summarize calculated fields in footer

How can I add a custom calculation to the footer of a grouped table?
These three columns show up great for each row and the footer group summarize works for the first two.
Just cannot figure out the summarize for the third calculated column...
Trying a custom summarizer:

TextColumn::make('leads_sum_connect_req')
    ->sum('leads', 'connect_req')
    ->summarize(Sum::make()->label('ConnctReq'))
    ->label('ConnctReq')
    ->description('ConnctReq'),

TextColumn::make('leads_sum_connected')
    ->sum('leads', 'connected')
    ->summarize(Sum::make()->label('Connected'))
    ->label('Connected')
    ->description('Connected'),

TextColumn::make('connected_percent')
    ->state(function($record){
        return ( $record->leads_generated->sum('connected')) / ($record->leads_generated->sum('connection_request')+ .01) * 100;
    })
    ->sortable()
    ->numeric(decimalPlaces: 1)
    ->summarize(
        Summarizer::make()
        ->label('Connected %')
        ->using(function($record){  // , but [$record] was unresolvable.
            return 99.9 ; // to test
            return ( $record->leads_generated->sum('connected')) 
                  / ($record->leads_generated->sum('connection_request')+ .01) * 100;
        })
)
TextColumn::make('leads_sum_connect_req')
    ->sum('leads', 'connect_req')
    ->summarize(Sum::make()->label('ConnctReq'))
    ->label('ConnctReq')
    ->description('ConnctReq'),

TextColumn::make('leads_sum_connected')
    ->sum('leads', 'connected')
    ->summarize(Sum::make()->label('Connected'))
    ->label('Connected')
    ->description('Connected'),

TextColumn::make('connected_percent')
    ->state(function($record){
        return ( $record->leads_generated->sum('connected')) / ($record->leads_generated->sum('connection_request')+ .01) * 100;
    })
    ->sortable()
    ->numeric(decimalPlaces: 1)
    ->summarize(
        Summarizer::make()
        ->label('Connected %')
        ->using(function($record){  // , but [$record] was unresolvable.
            return 99.9 ; // to test
            return ( $record->leads_generated->sum('connected')) 
                  / ($record->leads_generated->sum('connection_request')+ .01) * 100;
        })
)


With this I get an error:
An attempt was made to evaluate a closure for [Filament\Tables\Columns\Summarizers\Summarizer], but [$record] was unresolvable.
An attempt was made to evaluate a closure for [Filament\Tables\Columns\Summarizers\Summarizer], but [$record] was unresolvable.
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

Calculated fields in form builder
FilamentFFilament / ❓┊help
3y ago
Summarize Sum of a calculated field
FilamentFFilament / ❓┊help
2y ago
How can I use summarize to add the sum of a calculated column in a table footer?
FilamentFFilament / ❓┊help
2y ago
Table columns footer not being calculated using getTableContentFooter()
FilamentFFilament / ❓┊help
3y ago