Assigning Dashboard Variable to Influx Bucket w/ InfluxQL

Hello, Im using Grafana to view data in InfluxDB - using InfluxQL as the Grafana query language. I would like to have a grafana dashboard variable that can be used to switch between influxdb buckets. However, im not sure how without needing to develop a raw query, as opposed to using the “editor mode” that makes the query development simple and intuitive (which is important since i will not be the only end user and i want to minimize the learning curve for others).

Does anyone know how to configure this? See example of query below. Updating “Default” in the first line to the bucket variable i have created (bucket name is “test”) only results in the error “retention policy not found:test”. I am running Influx 2.7.

Thank you!

I found a workaround by doing the following - but super messy! Anyone know how to clean this up while still using the query editor? Is there a way to manually concatenate the string suffix with the retention policy to the bucket “test2”?

image

image