Automatically selecting an influx retention policy

I have a dashboard (using Grafana 5.4.3) which is connected to multiple influx data clusters. One is development, one is production. In the development cluster, all the databases have a default retention policy - something like “my_default” and the dashboards reflect that. But on many dashboards, we allow users to select “dev/prod” from pulldown variables and select the data source based on that. Unfortunately, if the production dashboard has a default retention policy named “prod_default” then the graph comes up empty - can someone tell me how to conditionally set the retention policy (the first field in the “FROM” statement in the query) based on the value of one of the variables?

Essentially if variable $site == “dev” then FROM “my_default”
if variable $site == “prod” then FROM “prod_default”

I have not been able to figure out how to manage conditionals based on variables… Any help would be appreciated