The {2} expression for the {0} {1}' has a scope parameter that is not valid for an aggregate function. The scope parameter ...

The {2} expression for the {0} ‘{1}' has a scope parameter that is not valid for an aggregate function.  The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset.