The problem here is that the sum method only performs direct queries to get the results. So using a mutator or a calculate column won't work! Luckily there is a workaround
public function calculate(NovaRequest $request)
{
$orderLine = OrderLine::selectRaw('SUM(quantity * price) as total');
return (new \Laravel\Nova\Metrics\ValueResult($orderLine->total))
->format(['thousandSeparated' => true])
->currency('$');
}
Something like this should work for you. Basically you're building your own ValueResult object that can be used to return the value you want to show. The value itself is just a value, so you can perform your own query and return that.