I’m trying to get a count of unique occurrences of a tag. I’m using a ‘filter’ to select the relevant data, then distinct to return only the distinct values. The problem is, distinct seems to return 2 tables. My Flux query is:
from(bucket:"areaEvent")
|> range(start: 2020-07-21T09:00:00.00Z, stop: 2020-07-21T09:10:00Z)
|> filter(fn: (r) =>
r._measurement == "areaEvent" and
r.areaId == "area_2"
)
|> keep(columns: ["visitorId"])
|> distinct(column: "visitorId")
|> count()
The output is:
Result: _result
Table: keys: [visitorId]
visitorId:string _value:int
---------------------- --------------------------
abc125 1
Table: keys: [visitorId]
visitorId:string _value:int
---------------------- --------------------------
abc126 1
How would I just get an output value of ‘2’, which is the count of distinct visitor IDs that appear in this result?