Add a having condition that makes use of COUNT
Instead of putting everything in one expression. I was able to achieve what I needed by creating an alias for the COUNT like so

$query-&gt;addExpression('COUNT(DISTINCT incidenttype.field_incident_type_tid)','typeCount');


and then add a having Condition afterwards using the alias I created like so.

$query-&gt;addExpression('COUNT(DISTINCT incidenttype.field_incident_type_tid)','typeCount');