Get Data Dynamically for No-Data Alerts

Hi, we wanted to created some No-data Alerts, for which we are using Grafana. So, we have a set of tags upon which one is most primary, let’s say the name is “Tag_main”, for each unique value of a “Tag_main” for which no-data case is there, we wanted to have a single alert.
My question is, how we can write the query in such format. Or if its not possible using query, can InfluxDB deadman alert will behave here differently. Also, for deadman alert I am getting error - “undefined identifier undefined”

Thanks