© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•13mo ago•
10 replies
gh057x

Table Summarize value based on state

I have a table column called cost, I've added a summarize attributes. How can I summarize all value based on state value?

Tables\Columns\TextColumn::make('cost')
                    ->alignRight()
                    ->state(function ($record) {
                        return costFormula($record->field1, $record->cost);
                    })
                    ->summarize(Tables\Columns\Summarizers\Sum::make())
                    ->numeric()
                    ->prefix('$')
                    ->sortable(),
Tables\Columns\TextColumn::make('cost')
                    ->alignRight()
                    ->state(function ($record) {
                        return costFormula($record->field1, $record->cost);
                    })
                    ->summarize(Tables\Columns\Summarizers\Sum::make())
                    ->numeric()
                    ->prefix('$')
                    ->sortable(),


Currently, the summarize value is based on the original data from database. I want it to be from ->state value
Solution
You could try a custom model property and add that to a new column? Or maybe add a column in the table and adjust it with ->formatStateUsing(function() { })
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

Table refresh based on select value
FilamentFFilament / ❓┊help
17mo ago
Custom summarize table
FilamentFFilament / ❓┊help
2y ago
Table summarize Layout
FilamentFFilament / ❓┊help
2y ago
Summarize Table RelationManager
FilamentFFilament / ❓┊help
3y ago