I’ve tried a couple of other attempts at making SUM work and not been successful so far. Not sure if I should be raising this here, or directly onto GitHub issues?
The reason we went with the current approach is because the aggregate should be at the parent level. In this example that would be with the root node. It’s better represented by using variables than directly using the predicate.