How-to Get the Energy Dashboard values

I am wanting to know how to get the cost values (and potentially others) that are generated from the Energy Dashboard.

I.e. how do I get the monthly cost at the bottom here?

image

I assume I can do it via some sort of SQL query to the db, but not sure what exactly I am looking for.

Otherwise if there is a way to setup a sensor that updates with this value, both weekly and monthly, that would be awesome.

Thanks!