Grafana on Influx DB: automated retention policy change base on zoom

Hi there,
I am using influxDB for storing timeseries data and Grafana v9.3.6 to display them in graphs. Because the data are too much, I am using continuous queries to downsample them and retention policies to erase high resolution data after a certain period of time.

So, I have three retention policies: leve_1, level_2 and eternal. What I want is to use a specific retention policy as follows:

If variable $timeFilter is smaller than 7 days I want to use “level_1”

If variable $timeFilter is smaller than 1 month I want to use “level_2”

Otherwise I want to use “eternal”

My progress so far is that I created a variable called $resolution that has the three retetnion policies as variables and I can choose which one I want but I cannot find a way to assign a specific value to this variable according to $timeFilter.

I think my issue looks like this one: InfluxDB: Automatically chose retention policy based on time range · Issue #73450 · grafana/grafana · GitHub
and this one: InfluxDB Retention Policy following $__interval contents

But none of them seem to be active