Calculated sum in statistics database is wrong

I have a problem with my Energy dashboard, where on one day I have a enormous production value. I wnet into the database to check what could be wrong, and it looks like Home Assistant has made an error when calculating the sum:

As you can see the states seems OK, but the sum increases with about 13 000 kWh between 13:00 and 14:00 when it should only have increased with 10.7 kWh.

Is there an easy and quick way to fix this?

This is usually because your sensor reports a value of 0 rather than unavailable.

You can fix the erroneous value in Developer Tools → Statistics.

You should fix your sensor too. Please show it’s YAML config if it has one.

This is a default sensor from the ofiical GoodWe integration and it has never reported 0.
You can clearly see where the calculation failed in the screen dump.

When the state increased from 9090.7 to 9101.4 the sum increased from 8740.9 to 21 858.7.

I guess your suggestion to fix the value under Developer Tools → Statistics is a feature added after 2022.2.6, which I am still running since I haven’t had the time to migrate my Z-wave setup to Z-Wave JS because I can’t fins a way to edit any values or recalculate the sum.