Flux query with where filter

Previously the following query used to give proper result but now it’s returning either error or ‘No result’ both within Grafana &/or Chronograf.

from(bucket: “L_OEEA_COMPACT”)
|> range(start: dashboardTime)
|> filter(fn: (r) => r[“_measurement”] == “RT_Dashboard”)
|> filter(fn: (r) => r[“_field”] == “StationID” or r[“_field”] == “Performance”)
|> pivot(rowKey: [“_time”], columnKey: [“_field”], valueColumn: “_value”)
|> map(fn: (r) => ({ r with _value: r.Performance }))

> filter(fn: (r) => r.StationID == 1)

How to solve this?? any ideas guys?

Hello @Aritra666B,
Is it possible that you don’t have data for the new dashboardTime?
If you change the start to -6mo do you get data?
What version of InfluxDB are you using?

When I debug Flux queries
I use the yield() function and I inject it after each line (after the range function) to see where flux is breaking.

|> yield(name: "results returned")

Hello @Anaisdg ,

Sorry for late reply… Issue solved. Basically the data I was getting via OPCUA had wrong datetime from the customer system.
Thanks for help

1 Like

@Aritra666B
yay! I’m glad its all sorted