Where clause filters rows in the query (Before they are aggregated).
Having clause filters rows after they have been aggregated.
i.e. Sum, Avg, Count, Max, Min, or any aggregate functions are always in a HAVING filter.
'Row based filtering' is performed in the where clause.
This is generally covered in standard SQL basics so you may want to read some background as this could help you.