Can you give an example here of the expected results. Please not a link. But sounds like you need a GROUP BY.
And there are running sums and final summary sums. Summary sums are separate queries.
Running sums:

Summary sums:

Grouping just example here count used, but sum would be similar:
$quy = Powner::query()->leftJoin('dc_pets', 'dc_powners.ownerid', '=', 'dc_pets.ownerid')
->select('dc_powners.ownerid', 'dc_powners.oname')
->selectRaw('count(dc_pets.petid) as countOfPets')
->groupby('dc_powners.ownerid')
->orderby('dc_powners.oname')
->get();
Results basically give:
ownerid, oname, countOfPets
Like:
5|Bob|3
4|Greg|9
2|Rob|1
But not sure on how you need to present the data. Normally some code is shown that has been tried.
I suggest getting a decent visual query builder either MS Access via ODBC or SQLeo is another and build this up to a regular sql query.