The message is quite obvious. You can not have multiple records in your sub-select. If you really need all these values, how do you want to display them? All in one row? Multiple row? How should other attributes be displayed??

Sub-queries must be scalar. As you demonstrate your sub-query returns more than one row. Hence the error.

One solution would be to correlate the results of the sub-query by joining the branch_id with the branch_id of the outer query. However, as both queries use the same table you can just use an analytic SUM() instead: