Discrete panel with Filtered Data

I am trying to use a discrete panel to show offline devices within a time range. If a device has always been online in that range I want it excluded. I haven’t been able to figure out the query with Influx to make it work.

Here is what I think the query would be for a SQL server but IN is not supported in Influx. Is there a better way to do this with Influx?

SELECT last(“valueBinary”) FROM “status” WHERE deviceName in (SELECT deviceName FROM status where $timeFilter AND valueBinary=0) fill(previous)

Thank you