I'm using QueryBuilder for this, but I can't figure out to get the sum and still have one whole list as a result.
Once you use COUNT
or SUM
then you should use a raw query instead of a query that returns entities. With a raw query you can either get the string result columns directly or map the selected columns and values using a row mapper.
See the docs here: