NewRelic NRQL: Having clause in alert condition

I have the following query


SELECT 
    count(*) AS ErrorCount,
    (filter(count(*), WHERE error = true AND http.statusCode="500") / count(*)) * 100 AS 'ErrorRate'
FROM Transaction 
WHERE appName="app_name" 
AND transactionType="Web" 
FACET name 
Limit 200
Having ErrorCount > 5

I want to create an alert for an error rate exceeding a certain threshold if the total error count also meets a criteria. Basically, I don’t want to get alerted if it’s only one request and it fails (100% error rate).
New relic alert query does not support, having clause or having two values from the query etc. How do I achieve this?

Read more here: Source link