Chart series based on count from two influxDB tables

I have a problem to configure my grafana dashboard correctly. I read data from an influxDB datasource where there are 2 tables (or measurements), called foo and greeting. Over a time window of 1 minute, these tables contains 600 entries each evenly distributed. This mean that for each second, there are 10 entries in each table, which gives a total of 20 entries per second.

I want to design one query that shows a series over that minute with the Y axis value equal to 20.

I’ve tried many kinds of queries but the result is either that the chart becomes empty, or that it shows a notification for some error that is occuring.

See my query below:
select fcount + gcount from (SELECT count(“value”) as fcount FROM foo WHERE $timeFilter GROUP BY time(1s) fill(null)), (SELECT count(“value”) as gcount FROM greeting WHERE $timeFilter GROUP BY time(1s) fill(null))

This gives me an empty chart. If I just use “select fcount” or “select gcount” they show the respective count value 10.

How can I achieve what I want?

I think you need to add another “GROUP BY time(1s)” to the end of the
outermost SELECT function (so, after the final bracket in the query you


Thanks @pooh, but it didn’t work. It actually made the legends foo.fcount_gcount and greeting.fcount_gcount to dissapear.

I have given up on achieving this. I had to rework my DB design. In order to do what I want, I now store all data that I need to aggregate into one series, in the same table (measurement). Instead of separating the different types of measurement from eachother by different measurements, I now do it with different values in a new column. So for my original example above, I store the data from both tables foo and greeting, into a transaction table. This table has a new column called type where the value are “foo” or “greeting”. In grafana I now can design queries with select count(*) from transaction. For queries where I need only a specific measurement, I add: where type = “foo”

This ticket may be closed!