yes, probably your database got somehow corrupted (I had this too in the past, whenever I wanted to fix a bad reading in the DB)…
unfortunately I haven’t found any way to fix this kind of issues - resulting in a data loss until now.
This is, why I have changed to a MariaDB as recorder, running on a different server than HomeAssistant.
I think, maria DB would be a bit more reliable than such a SQLite file… and I could create backups more easily…
I think, there’s a way to restore such old values - BUT, it would require a lot of manual effort and some basic knowledge about databases…
you could stop HomeAssistant, backup all existing database files (even the corrupted ones) - export the data.
You could then import the data into a new DB - but you probably need to do some recalculations on the statistics… and with some luck, Homeassistant could use the newly created database.
But since I haven’t done tests on it, I am not sure if this could work.