Do you count up forever or do you reset to 0 periodically (e.g. once a month)?
I assume you are using persistence to store the values into the database, right? If so you will need to use restoreOnStartup for these Items.
Create a Rule that triggers when the Item for these plugs changes.
if(previousState > currentState)
triggeringItem.postUpdate(previousState + currentState)
Now where it get’s complicated is handling the case where you deliberately reset the value to 0. You may have to do something like Design Pattern: Manual Trigger Detection.
You will also need to account for changes to/from NULL and UNDEF states and you will likely need to case the states to Numbers. And that erroneous low value will get saved to your persistence. To avoid that, you will need to use a proxy Item to persist the value and in that Rule above update the proxy Item instead of the linked Item.