I need help with Flux

I want to select all distinct values of db into a Grafana variable. I get only the first value. The query is the following:

from(bucket: “Telegraf”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: ® => r["_measurement"] == “postgresql”)
|> keep(columns: [“db”])
|> distinct(column: “db”)

@Frans_Verduyn_Lunel you could use the schema.tagValues() function:

import "influxdata/influxdb/schema"

schema.tagValues(
  bucket: "Telegraf",
  tag: "db",
  start: v.timeRangeStart
)

Hi Scott,

Thank you very much :+1: