Possibility to count one series data only when second series values are in defined state

Hi, I am looking for a possibility/solution to measure one data series only when second series data are in a certain state/range.
Eg.
a. I have series energy_produced and inverter_power for PV. I would like to know how much energy was produced but only when inverter power was above 5kW
b. I have series energy_consumed_by_HiFi and HiFi_states (with eg. states TV, Radio, DVD). I would like to know how much energy was consumed by HiFi set when TV was on.

I feel it is easy but I am definitelly noob in Grafana.

  1. Which version of Grafana are you using?

  2. Which back-end data store are these data series in?

The back-end data store query language is the important part for working out
what queries Grafana can perform.

Antony.

Hi Antony,

I use Grafana as an add-on on Home Assistant. Grafana is in version 8.1.2. it uses data collected in influxDB (v. 1.8.9; Chronograf v. 1.9.0).
Query Language used is influxQL with the possibility to change to Flux (but I am not experienced in that).

Jakub
PS. Sorry for so late response but I was not notified I do have an answer in this thread.

@pooh It’s not entirely consistent with the netiquette to mark someone, but I tought it might just be run off, you get my answer.
Unfortunately, I still haven’t found the solution.