How to get two results in two columns inside a table

If I have this two queries:
A:

from(bucket: "monitoring")
 |> range(start: v.timeRangeStart, stop: v.timeRangeStop) 
 |> filter(fn: (r) => r["hostname"] == "switch_name")
 |> filter(fn: (r) => r["_field"] == "DestinoInterfaz")
 |> filter(fn: (r) => r.NombreInterfaz == "Gi1/0/21" or r.NombreInterfaz == "Gi1/0/22")
 |> aggregateWindow(every: v.windowPeriod, createEmpty: false, fn: last)

And B:

from(bucket: "monitoring")
 |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
 |> filter(fn: (r) => r["hostname"] == "switch_name")
 |> filter(fn: (r) => r["_field"] == "EstadoInterfazInt") |> filter(fn: (r) => r.NombreInterfaz == "Gi1/0/21" or r.NombreInterfaz == "Gi1/0/22")
 |> aggregateWindow(every: v.windowPeriod, createEmpty: false, fn: last)

I get something like this:

screenshot_2023-04-10_at_11.44.44_480

But I want to have A in one column (“AP TPLink…”, etc.) and B in another column ({1,2}). I guess it can be done with a transform… which one? I’ve tried a lot of ones… with no success
If needed, it can be only one query (“A”) with something like:

|> filter(fn: (r) => r["_field"] == "EstadoInterfazInt" or r["_field"] == "DestinoInterfaz" )

I’m using Grafana 8.5 with InfluxDBv2 as Data Source.

I would use inner join transformation. I guess 8.5 has also some join transformation.

8.5 only has outer join. I’ll try with a newer version. Thanks.

At the end I used two transofrmations: outer join (in 8.5 doesn’t exists inner) and then Reduce (Series to Rows) with the Labels to Fields option turned on and then I had to hide a lot of labels (now fields because this las option I mentioned) and the result is not ideal, but kinda works:


(I used Field mapping to change the “1 and 2” to arriba (Up) and abajo (down).
I don’t love it, but works. Thanks.

@doncucumber

Sounds like you have it all working, but if you want to experiment around, you can try doing a join in InfluxDB of your two queries and then plot (in Grafana) query C. More here.

Nice. I’ll check that out and study it. Thanks!