I want to create a Table including ap_name, radio band, channel, EIRP, Noise Floor.
I tried this Flux query:
from(bucket: "data")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "AP")
|> filter(fn: (r) => r["ap_name"] == "D1_xxx_xxxx")
|> group(columns: ["ap_name", "radio_band", "channel", "eirp_10x", "noise_floor"], mode: "except")
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
|> yield(name: "last")
However, it only shows the ap_name, radio_band, and channel columns.
FYI, ap_name, radio_band, and channel are field keys, while eirp_10x and noise_floor are tag keys.
How can I solve this so I can display the tag keys as table columns?
Hello @alifyazhafira29,
First of all, you can’t select tag with InfluxDB : in InfluxDB, tag keys are metadata associated with measurements, while field keys contain the actual data values. I think you should ask your question in the Influx community…
Regards
2 Likes
I found out that the tag I want to display is a field by checking it in the influxdb (I didn’t have access to it before and only found out by doing some queries through grafana). I also found the solution by using this query.
|> filter(fn: (r) => r["_field"] == "max_eirp")
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> keep(columns: ["ap_name", "radio_band", "channel", "max_eirp"])
|> group()
It starts by filtering the data using the filter
function, which applies a set of conditions to each row. Next, the pivot
function is used to transform the data into a pivot table. The keep
function is then used to select specific columns from the pivot table. Finally, the group
function is used to group the data by the selected columns.