Handeling derivative where the counter resets


Consider a counter that has a counter that counts net energy for example, this counter will eventually reset once it reaches a certain value.

To calculate the power, we can use derivative(), but we get problems when the counter resets, resulting in a huge spike.

I could use non_negative_derivative(), but if the net kWh decreases this will not show.

How do people solve this problem?

Hello @Baarken,
What version of InfluxDB are you using?
I think you could do this in Flux, but Iā€™m not sure how at the moment.
Maybe something involving map() with conditionals.

1 Like