Grouping month year and group summarize (total amount)

I couldn't figure out what I do wrong. grouping expenses by month-year works but when I want to show summarize on each month, sum is wrong Here is my Code
---
Tables\Columns\TextColumn::make('amount')
->label('Amount')
->money('EUR')
->sortable()
->summarize(
Tables\Columns\Summarizers\Sum::make()->label('Total')->money('EUR', divideBy: 100)
),
---
->groups([
Group::make('date')
->getTitleFromRecordUsing(
fn(Expense $record): string => Carbon::parse($record->date)->format('F Y')
)
->orderQueryUsing(
fn(Builder $query, string $direction) => $query->orderBy('date', $direction)
)
->titlePrefixedWithLabel(false)
->collapsible(),
])
---
Tables\Columns\TextColumn::make('amount')
->label('Amount')
->money('EUR')
->sortable()
->summarize(
Tables\Columns\Summarizers\Sum::make()->label('Total')->money('EUR', divideBy: 100)
),
---
->groups([
Group::make('date')
->getTitleFromRecordUsing(
fn(Expense $record): string => Carbon::parse($record->date)->format('F Y')
)
->orderQueryUsing(
fn(Builder $query, string $direction) => $query->orderBy('date', $direction)
)
->titlePrefixedWithLabel(false)
->collapsible(),
])
No description
1 Reply
toeknee
toeknee7h ago
Seems to only be getting the last value. What does your model look like?

Did you find this page helpful?