Trigger alarm when the normal state is null value and alarm is 1

Hi Community,
sorry If I will ask something stupid, but I’m pretty new in the Grafana world and I’m trying to learn fast. I have a question regarding the alerting. I’m using Grafana 9.1.2
I was trying to trigger an alarm when some events occur. The problem is that the event has only one state. So for example in the is a failed login then the query result is 1 otherwise I have no data. I don’t know how to create an alert rule because basically in the normal condition I have no data. Below one example
Thanks in advance


  type AS metric,
  count(type) AS "type"
FROM event_entity
  type ~* 'LOGIN_ERROR' AND $__unixEpochFilter(event_time/1000)

maybe you can use a “case statement” to build your state field in corcordance with your condition
if no data you can handle default value and build multiple state.

Not expert in alert , not sure if it’s the best way to proceed but it’s should work