In any case, you haven't shown exactly what you've tried to do.
I do know there are special template queries for Grafana variables. Here are a couple of examples I've pulled from a local dashboard:
Name: instance
Type: Query
Data source: prometheus
Query: label_values(ifOperStatus, instance)
Name: ifName
Type: Query
Data source: prometheus
Query: query_result(ifOperStatus{instance="$instance"})
Regex: /.*ifName="([^"]+)".*/
I would have thought you could use query_result(up==0), since that's a valid PromQL query, and you could pull out the label you want (e.g. instance) using a Regex as shown.
But if that doesn't work, then please ask on a Grafana forum.