Calculate electricity price for a time range using spot prices

I have a spot price electricity, the price changes every hour. I have this price information in grafana (influxdb). I have also my energy consumption there but I can’t figure out how to calculate the total price for a specific time range.

For example, if I want to see the total costs for a 5 hour period, I would need to sum every hours price separately * that hour’s used energy. This is where my skills are not enough.


Welcome @hjpniemi

Are you using Flux or InfluxQL?

Here is a solution using Flux.

Thanks, I think I can proceed with that information, for sure couldn’t figure that out myself…