Bar graph from momentarily Watt-Values

Hello Community,
i have a problem creating a Visualization where my Power-Values from Smartmeter (in W) are visualized as Bar Graphs for every Day/Month/year.
I’m only storing the momentarily Values in the InfluxDB. I can also store the meter count in the db, but for that i don’t have that year of data history stored. So it would be better if i can do the calculation directly in grafana.
I already figured out that i have to do the integral over the values and then do a math with divide by 3600 to get to Wh.
But i did not get how to choose the time over which this is calculated. In the time field the max i can choose is 1h.
And how can i make this selectable what time aggregation i want (day/month/year)?
Can anyone help me out with this?
Regards
ionfan

Has no one an idea? Is my question unclear? Please ask if i wrote my explanation not clear.
Regards
ionfan

What frecuency are you using for capturing the data??
Maybe you can get some ideas from here