Select the Value of one Timeseries if certain value of other Timesieries

  • What Grafana version are you using?
    Im using Grafana 7.5.11 and influxDB 2.0

  • What are you trying to achieve?
    I have two timeseries. The first one contains data about the mass of the produced product and the other contains data about the machine status. I want to post the value of the first timeseries but only if the second timeseries shows a certain value.

  • How are you trying to achieve it?
    I tried to apply the following query:
    Select mean(“tag1”)
    FROM(
    SELECT distinct(“Mass”) as “tag1” FROM “Measurement” WHERE $timeFilter GROUP BY time(1m) fill(previous)
    ),(
    SELECT distinct(“Status”) as “tag2” FROM “W_UHT-1” WHERE $timeFilter GROUP BY time(1m) fill(previous)
    )
    Where (“tag2”=1) and $timeFilter GROUP BY time(1m) fill(previous)

  • What happened?
    The query resulted in no data

Is there a way to achive my goal?