Aggregations aren't possible within a dimension unless they wrapped with an aggr() which makes it to a calculated dimension. Means something like:
aggr(YourExppression, Dim1, Dim2)
whereby Dim1 and Dim2 are placeholder for the dimensionality in which context the calculation should happens - often it are the other dimensions from the object but sometimes it may also a granularity deeper.