© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•12mo ago•
2 replies
Arjan

Issue with Sorting a Summed Relationship Column in Filament Table

I have a Filament table displaying a list of my “Projects.” One of the columns calculates the sum of the “converted_net” values from the related “payments” table. This works correctly, and for projects without payments (i.e., nothing to sum), the column displays 0.

However, sorting this column does not work as expected. When sorting in descending order, projects with no payments (null values) appear at the top instead of those with the highest payment sums.

How can I fix this?

                    TextColumn::make('payments_sum_converted_net')->sum([
                        'payments' => fn(Builder $query) => $query->whereNull('statement_id')->whereNotNull('received_at')->whereNotNull('converted_net'),
                    ], 'converted_net')
                        ->default(0)
                        ->money(fn(Project $record) => $record->currency->iso_code_3, divideBy: 100)
                        ->label('Payments')
                    TextColumn::make('payments_sum_converted_net')->sum([
                        'payments' => fn(Builder $query) => $query->whereNull('statement_id')->whereNotNull('received_at')->whereNotNull('converted_net'),
                    ], 'converted_net')
                        ->default(0)
                        ->money(fn(Project $record) => $record->currency->iso_code_3, divideBy: 100)
                        ->label('Payments')
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

relationship sorting in table
FilamentFFilament / ❓┊help
3y ago
Table column loses data when sorting by relationship
FilamentFFilament / ❓┊help
3y ago
Filament table sorting Bug
FilamentFFilament / ❓┊help
3y ago
JSON relationship column in table
FilamentFFilament / ❓┊help
14mo ago