How to sum values from a product table in cakephp3

I have a table with the branch column and another total, precise sum total value of each branch for example:

RN = 10
PE = 20
PB = 10
RN = 20
PE = 30

I want to add the value of RN and PE

RN = 30
PE = 50

In mysql I can do it but I’m not sure how to do it in cakephp3 I’m using the following query in mysql (SELECT SUM(total)from comandas where branch = ‘RN’),
How do I do it in the cake 3.4?

https://book.cakephp.org/3.0/en/orm/query-builder.html#aggregates-group-and-having

$query->func()->sum(‘field’);