I am Sending my KWH consumption values to the InfluxDB every 3 hours from my Meter which logs the running totaled value.
On the cloud influxDb2 dashboard I want to show the KWH consumption. To find the Consumption for a given period of time. I am using the Spread() function to subtract the first value from the last value. this is causing issues when the meter reset to zero due to many things.

I want to calculate the cumulative sum of the data instead of just trying to use spread(). Can someone help me with this?

This meaning I need to sum only the delta between two consecutive values, that too the positive delta not the negative delta.