Fluxlang, calculate the latest hour over time derivative

I am trying to pull a counter the hour values ​​from influxdb.
However, the last part of the hour makes no sense
The latest caculation in the picture is 90.2 this is impossible since the meter can deliver about 105 per hour
So what is the 90.2 calculation based on?
Other question how to ignore this unwated result from the list.

Hello @Admini,
I’m confused, why is 90.2 a wrong calculation but 96.9 is not? What do you mean by

90.2 this is impossible since the meter can deliver about 105 per hour

Can you describe your use case? and maybe share some of the raw data? Have you looked at the data prior to applying the derivative and manually calculating the derivative yourself to verify whether or not the function isn’t working?

If you’re looking to just exclude that last line of data can you try:

import "date"

lastHour = date.truncate(t: now(), unit: 1h)

from(bucket: "<your bucket>")
    |> range(start: -1h, stop: lastHour)

Yes that is working.
without your help

_time                           _value        _field

2021-05-17 18:00:00 GMT+2         88.2         WaterIn

2021-05-17 19:00:00 GMT+2         95.0         WaterIn

2021-05-17 20:00:00 GMT+2         95.0         WaterIn

2021-05-17 21:00:00 GMT+2         85.8         WaterIn

2021-05-17 22:00:00 GMT+2         56.6         WaterIn

2021-05-17 22:16:12 GMT+2         82.9         WaterIn

the last value 82.9 from 22:00 - 22:16 is strange so i wanted to leave that value out.

2021-05-17-22-09_chronograf_data.txt (2.8 KB)

1 Like