I’m thinking you should probably be massaging your data before it is stored (incorrectly) in the database.
Filter for reasonable values and discard the rest at sensor stage, and your energy dashboard will then be beautifully displayed.
There is an option to filter outliers in one of the developer options. Not sure if you can make that work for you for historic sensor data, otherwise you may have to go back and modify your database directly.