The Aggr function will create an array of values. The first parameter, which must be an aggregation function, e.g. Sum or Count, defines the values in the array and the other parameters define the grouping fields (like SQL GROUP BY).
The aggr function can only be used in the UI objects (cannot be used in the script).
In your case you must have Year and Month as dimensions in the chart - otherwise the Aggr will return several values, which cannot be used unless you put another aggregation function outside the Aggr function, e.g.