Aggregate Looping
Non-aggregate functions execute in the looping context of their enclosing expression and output map element. Sometimes it is necessary to access data from an unrelated loop, for example, you might want to take the sum of all values from the input. Use aggregate functions for this. Each aggregate function allows you to specify a loop expression for each of its arguments, creating a new loop context for each argument.
The loop expression for an aggregate function is always the first argument of each argument of the function. In the LoopAggregate example, the value expression for TotalNotices counts the number of Notices/Notice/Num elements in the output.

Note the loop expression below the map element reference to Notices/Notice/Num. That is where the loop expression is placed. In this case, the loop expression is a reference (LoopReference) to the loop expression of the output element Notices/Notice/Num.