Summary of all the column values

Hello! I created this text column that shows the total sum of every row I have in the table:
Tables\Columns\TextColumn::make('sum_total_row')
->label('Activities Total')
->default( fn(Model $record) => $record->activities->sum('pivot.attributeX'))
->money('EUR')
->summarize(Summarizer::make()
->label('Total')
->using(fn () => 888)
);
Tables\Columns\TextColumn::make('sum_total_row')
->label('Activities Total')
->default( fn(Model $record) => $record->activities->sum('pivot.attributeX'))
->money('EUR')
->summarize(Summarizer::make()
->label('Total')
->using(fn () => 888)
);
I also want to show the total sum of this specific column values. I managed to show a hardcoded number (888) above the column, but I can't show the dynamic sum. I can't use the standard way to calculate the column sum, because this is not a DB column, it's dynamically created in my ManageRelatedRecords class. Thanks!
2 Replies
nicobrave
nicobraveOP3mo ago
Anyone can help?
Matthew
Matthew3mo ago
Sum the original data, rather than trying to sum your subtotals
Want results from more Discord servers?
Add your server