The Expression engine (SQL) doesn’t allow to apply an aggregation function on top of another aggregation function.
Expression = AVG(SUM(ValueField_A))
This results in an error :
“Cannot perform an aggregate function on an expression containing an aggregate or a subquery.”
To solve this, you should leave only 1 level of aggregation functions (think about what you really want to calculate and test on a small dataset).