How to stop net consumption utility meter resetting to zero each day

I have two sensors that track the total daily cost of electricity that we have consumed based on two different tariff calculations (say tariff 1 and tariff 2). I have a third sensor that tracks the daily cost difference between these two tariffs. Sometimes this third sensor is positive (if tariff 1 - the one we are on - is cheaper than tariff 2) and sometimes is negative (if tariff 2 is cheaper than tariff 1). Each day at midnight our electricity consumption resets to 0, so the sensor tracking the cost difference also resets to 0.

I want to track the total positive or negative cost saving on a monthly basis so I can decide if being on tariff 1 is good value for money. I created a utility meter using the sensor that tracks the daily cost difference. Because the cost difference can be positive or negative, I set the net_consumption configuration variable to true. Due to rounding errors the cost difference can also fluctuate slightly during the day, so setting net_consumption to true also ensures that no double counting occurs.

The issue I am having is that when the cost difference resets to 0 at midnight, the negative difference is exactly equal to the value of the utility meter, so the meter is reset back to zero. Is there a simple solution to prevent this from happening?

I am currently trying to work on a solution that uses a input_number helper to workaround this issue, but would appreciate any advice if there is a way to prevent this behaviour without creating additional automations and helpers

This is the sensor that tracks the daily price difference:

    - name: "Octopus Tracker gas savings"
      unique_id: "octopus_tracker_gas_savings"
      state_class: "measurement"
      state: >
        {% set tracker = states('sensor.octopus_energy_gas_current_accumulative_cost') | float(0) %}
        {% set price_cap = states('sensor.octopus_price_cap_gas_cost') %}
        {% set price_cap = price_cap.split('£')[1] | float(0) %}
        {{ (price_cap - tracker) | float(0) | round(2) }}  

This is the utility meter

    source: sensor.octopus_tracker_gas_savings
    name: "Total Octopus Tracker Gas Savings"
    unique_id: total_octopus_tracker_gas_savings
    cycle: monthly
    net_consumption: true