Message Oracle PLS-00604 - aggregate function is not allowed here

ERRORaggregate function is not allowed here
CAUSEOne of the functions, such as AVG, COUNT, MAX, MIN, SUM, STDDEV or VARIANCE, was used in a WHERE or GROUP BY clause
ACTIONRemove the group function from the WHERE or GROUP BY clause. The desired result may be achieved by including the function in a subquery or HAVING clause.