Dashboard variable with filter

Hello,

I actually used a dashboard variable with the following query:

import “influxdata/influxdb/schema”
schema.measurementTagValues(
bucket: “bucket-grafana”,
tag: “host”,
measurement: “HG”
)

I search a way to filter with a variable from another query:
2nd variable query:

import “influxdata/influxdb/schema”
schema.measurementTagValues(
start: -720d,
bucket: “bucket-grafana”,
tag: “serial”,
measurement: “Port”
)

So i tried with the following new query without success:

import “influxdata/influxdb/schema”
schema.measurementTagValues(
bucket: “bucket-grafana”,
tag: “host”,
|> filter(fn: (r) => r.serial == “${Serial}”),
measurement: “HG”
)

Many thanks for help.

i found the solution:

import “influxdata/influxdb/schema”

schema.tagValues(
start: -1y,
bucket: “bucket-grafana”,
tag: “host”,
predicate: (r) => r._measurement ==“HG” and r.serial == “${Serial}”
)