How to combine multiple select from different measurments?

Hello,
Is it possible to combine two selects and do some math on result? Below - what I’m trying to do.
When I execute single SELECT it returns proper values, but when I combine them nothing is drawn.
Is it possible to do it from graph definition?

SELECT ( (sum(“opt12”) / sum(“dst45”)) * 100 )
AS “Ratio”
FROM (
SELECT mean(“ratioopt12”) AS “opt12”
FROM “ottb.gen.11”
WHERE “hostname” = “serv1” AND $timeFilter GROUP BY time(15m) fill(null)
),
(
SELECT mean(“ratiodst45”) AS “dst45”
FROM “ottb.gen.14”
WHERE “hostname” = “serv1” AND $timeFilter GROUP BY time(15m) fill(null)
)
GROUP BY time(15m) fill(null)

Regards,
Mike

As far as I know, anything like this is possible in Grafana, provided the
query language for your back-end data store gives Grafana a result it can
represent.

So, my question in return would be: “what happens when you try such a query
directly in the command line client for you back-end data store?”

If you get a result whicvh you think Grafana should be able to deal with, show
us what that is.

Alternatively show us any error you get, or failing that, use the Query
Inspector in Grafana to find out what it is being given when it tries the query
on the data store.

Antony.

When I execute single SELECT which is component of my combined query it returns not null data in each interval (I see it in query inspector), but when I combine these two SELECTs as in my example - it returns intervals with null value. No error is displayed.

Anyway - when I modify exactly the same statement but both counters are from the same measurement - graph is drawn normally.

SELECT ( (sum(“opt12”) / sum(“dst45”)) * 100 )
AS “Ratio”
FROM (
SELECT mean(“counterA”) AS “opt12”
FROM “measurement1”
WHERE “hostname” = “serv1” AND $timeFilter GROUP BY time(15m) fill(null)
),
(
SELECT mean(“counterB”) AS “dst45”
FROM “measurement1”
WHERE “hostname” = “serv1” AND $timeFilter GROUP BY time(15m) fill(null)
)
GROUP BY time(15m) fill(null)

I know - above is possible in single query SELECT sum("counterA) + sum(“counterB”) FROM “measurement1” but I wanted to check if statement is ok.

In my original SELECT from question we have two different measurement - I need to do some maths on counters from 2 different measurements and get one plot, but I receive 2 arrays with intevals filled with null value.

BR
Mike