Interval type variable problem

The version of Grafana I used was 10.2 and the operating system was linux. A field in the data source was the size of the transferred file, and there was an interval variable named bin in the template. The value of bin was 10m, 30m, 1h, 6h, 12h, 1d, and 7d. For example, For example, if the bin value is 10m, divide the size of the file to be transferred within 10 minutes by 10 minutes.

I used two metrics, the first being sum (filesize) and the second bucketscript using sum (filesize) /${bin:raw}. But this is not possible, is there a way to convert bin values to number types in bucketscript computation, such as 10m to 600,1d to 86400.

I tried to create a second template variable of type custom named avg_speed_time with values of 600, 1800, 3600, 21600,43200, 86400, 604800, bucketscript uses sum (filesize) / ${avg_speed_time:lucene} in the second metric, but there are two template variables, and I need to select the corresponding values for both of them to get the effect I want. Is there a way to link these two variables, such as when the bin variable selects 10m, the avg_speed_time variable automatically selects 600?