Ignore going back to zero

Please see my measurement of data consumption. It gets to 4GB, and then back again to zero. This can happen several times a day or not for a day.
I want to get the memory consumption per day. It should sum up all positive increments from 0h - 24h and ignore the jump back.

this isnt working, because it removes days with jumps:

SELECT (non_negative_difference(last(“value”))) FROM “measurement” WHERE $timeFilter GROUP BY time(1d)

is there a way to ignore the zeroings?

SELECT non_negative_difference(value) AS increment
FROM “upnp.0.WANDevice_-_FRITZ!Box_6660_Cable.WANDevice.WANCommonInterfaceConfig.TotalBytesReceived”
WHERE $timeFilter
Group by time(1d)
FILL(0)

the problem here is that the aggretate function comes before the non_negative_difference making it useless. Doing the other way is not working

i found it out i have to do a double select … from …