Energy Dashboard data gone after migration from MariaDB addon to external MariaDB instance

I have moved and migrated from the integration addon MariaDB to and external MariaDB server outside of my HomeAssistant instance.
Everything seems to work correctly except my Energy dashboard.
All the past data is gone.
Only on some days it show some cost number without any KWh number.
And also today shows a negative cost number.

tom_l I noticed you helped some other people with this problem. I have read the other posts you commented on but could not find a way to fix my issue.