Use a filter in a Dashboard variable

I search to use a filter as a variable in dashboard variable.
the tag filter is located in the same measurement.

I use fluxquery with an InfluxDB Data source.

I tried this:

import “influxdata/influxdb/schema”

schema.tagValues(
bucket: v.bucket,
tag: “MyTag”,
predicate: (r) => r._measurement == “serial” and r.serial == ${serial},
start: -365d
)

Is it possible ?
Many thanks for help.