@rrrrando Have you tried this?
->selectSub(function ($query) use ($dateRange) {
$query->from('invoice_row AS sub_row')
->whereColumn('invoice_row.id', 'sub_row.id')
->whereBetween('invoice_date', [$dateRange->startDate, $dateRange->startDate->copy()->addDays(10)])
->sum('sub_row.row_net');
}, 'first')
But, keep it mind that in some cases, the selectSub method may not provide the desired level of control over the subquery's behavior, or it may not be possible to achieve the desired query logic using the selectSub method alone. In such cases, using DB::raw can be a useful alternative as it allows you to specify the subquery as a raw expression, giving you full control over its behavior.