Hello All,
I need advice from all experts here to solve my problem on Grafana dashboard
I have data machine state which already store to InfluxDB. The query is save every machine state changes (4= Production, 3= Stop, 2= Starve, 1= Standby). I was successfully visualized that data with state timeline on Grafana Dashbaord.
here is my FluxQL query:
from(bucket: "DEMO")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Word_Equipment_Exec")
|> filter(fn: (r) => r["_field"] == "value")
|> filter(fn: (r) => r["equipment"] == "CSP-JK")
|> filter(fn: (r) => r["line"] == "PP-PACK-JK")
|> filter(fn: (r) => r["parameter_name"] == "MachineStatus")
|> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
|> yield(name: "last")
But, I need to calculate total production time based on time filter. for example, if time filter is today then Grafana will calculate total production time today (only the green one).
appreciate if someone can help this problem.