Grafana power cost with two tarriffs

Hello,
can someone give me some example how to calculate power usage in USD based on day and night power cost. Here is my example based on one tarrif and this one is working fine just want to define from 06:00-22:00 and 22:00-06:00. Thanks in advance.

SELECT cumulative_sum(mean(“value”)) *0.20 FROM “autogen”.“power” WHERE (“deviceId” = ‘06c223fe-5633-458b-b8da-bca94e4ffb7e’) AND $timeFilter GROUP BY time(1h) fill(null)

That might be tough using InfluxQL. I found this solution using Flux.

1 Like