How do I create something like a global variable to be used in flux query for use in multiple dashboards and panels?

How do I create something like a global variable to be used in flux query for use in multiple dashboards and panels? There will be about 90 sets of these values in probably 100 dashboards. Some of these values will change on a weekly basis if not more often.

I can’t do a query my data doesn’t have that info to group because it changes so much. Relying on people to remember that will also be difficult.

Using grafana v8.3.4 and influxdb
|> filter(fn: (r) => r[“HRS”] == “BW” or r[“HRS”] == “EW” or r[“HRS”] == “UR” or r[“HRS”] == “PB” or r[“HRS”] == “XW” )

Welcome to the Grafana forum.

Flux queries need to have their variables in quotes, for example:

|> filter(fn: (r) => r["host"] == "${myvariable}")

Thanks for your quick reply

That helps me ask my question in a way that is more clear.

What I am wanting to do is set a variable like this:

myvariable = r[“HRS”] == “BW” or r[“HRS”] == “EW” or r[“HRS”] == “UR” or r[“HRS”] == “PB”

Then use it like this:

|> filter(fn: (r) => "${myvariable}")

I can’t figure out where to create a variable like that that will be available for multiple dashboard where the values will be different.

Did you already click on the gear (Dashboard settings)…

…and go this screen and play around with it?

Are BW, EW, UR and PB one particular set of variables (that belong to “HRS”)? And you have 90 or so sets of different variables? Are these all tags in InfluxDB?