Table summary not working for accessors

Hello I try to build a summary for an accessor, which counts an amount of a hasMany relationship.
Tables\Columns\TextColumn::make('totalValue')
->label('Total Value')
->formatStateUsing(fn($state) => number_format($state, 2))
->sortable()
->money('EUR'),
Tables\Columns\TextColumn::make('totalValue')
->label('Total Value')
->formatStateUsing(fn($state) => number_format($state, 2))
->sortable()
->money('EUR'),
this works as expected, but when I add the summary:
->summarize(Tables\Columns\Summarizers\Sum::make()
->label('Total Sum')
->formatStateUsing(fn($state) => number_format($state, 2))
)
->summarize(Tables\Columns\Summarizers\Sum::make()
->label('Total Sum')
->formatStateUsing(fn($state) => number_format($state, 2))
)
this breaks because totalValue doesn't exist as a column.
PK
Povilas K17d ago
Maybe try custom summaries repeating the same condition as in the accessor: https://filamentphp.com/docs/3.x/tables/summaries#custom-summaries Not convenient, but should work.