Can't show tag as column

Hi all, I’m new to Grafana and have what I think is a simple query, however, I just can’t work this out. the query works as expected in InfluxDB 2.7.1

Version Garafana 10.01

I’m trying to show the “sensor_id” in a column, the id is a tag and a string.

This is the query

from(bucket: "volt_sense")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "mqtt_consumer")
  |> filter(fn: (r) => r["level"] == "${q_level}")
  |> filter(fn: (r) => r["area"] == "${q_area}")
  |> filter(fn: (r) => r["location"] == "${q_location}")
  |> filter(fn: (r) => r["_field"] == "A0" or r["_field"] == "A1" or r["_field"] == "A2" or r["_field"] == "A3" )
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value") 
  |> keep(columns: ["_time", "_value", "sensor_id","A0", "A1", "A2", "A3"])
  |> yield(name: "last")

However, I only get this as an output

I would have expected to see the “sensor_id” as one of my columns.

Any help would be greatly appreciated

Cheers

Hi @dirkeisner

What happens if you insert this line as an additional filter? (not sure about your actual tag name being used, so I guessed, but this is probably close)

|> filter(fn: (r) => r["sensor_id"] == "${sensor_id}")