Get graph on energy

Hi, I’m using grafana with influxdb and Home Assistant. I have a counter that shows energy in kHw and I want to display how much energy it has consumed every day in one graph and every week in another, possibly every month also.

I cant get it to work, it doesn’t show the right numbers for some reason. My query looks like this:

SELECT difference(mean(“value”)) FROM “kWh” WHERE (“entity_id” = ‘pump_energy_kwh’) AND $timeFilter GROUP BY time(1w) fill(null)