Sumarize IF.....

I have this column in my table:
TextColumn::make('detalles.total')
    ->label('Total Detalle')
    ->getStateUsing(fn ($record) => $record->anulado? 0 : $record->detalles->sum('total'))
    ->money('ARS')
    ->summarize([
        Sum::make('total')->money('ARS')
    ]),

this sum every proformas_detalles total where anulado = 0, but when i tried to summarize the total its sums everything.
any idea?
Was this page helpful?