It will be depend on the kind of expression if you get a correct subtotal - something like sum(sales) will always work but something like quantity * price won't - in such a case you might need: sum(aggr(quantity * price, articel)). This meant you will probably need: