Display default value if outside of time range

Graphana with influxDB as the data source.

I have a stat panel that shows On / Off values for my various virtual machines based on ICMP ping.

If any of the VM’s are off and outside of the time range the stat query showing on or off disappears from the panel. I assume this is due to the query returning null because the data doesn’t exist in the time range - that’s fine, I understand that.

My question is can I default to a value if the query returns null because outside of the time range? Or can I have a ‘default value’ return if the query returns null? If the ping does not connect I want the panel to show Off letting me know the VM is not connected, or at least, the ping isn’t returning so I can check it out.

maybe you could do a check on the data returned if null provide default value

data = from(bucket: "example-bucket")
    |> range(start: -5m)

if data = null

kind of thing if that is possible in flux. or are you using influxql query language

influxql, can I do the same null check there?

I just tried running the query directly from influx panel and I can get the data to update FILL values to 0 which I think will work, its just when I try to run the same/similar query in Graphana the stat tile still remains hidden.