Unable to create time series ... am I too stupid for this?

I am not able to create a time series graph for my InfluxDB data.

The data looks something like this. There are more tags and values, but I need only these three: Country, Value and time. Time is in seconds and the same for each country per day because the data gets fetched at the same time (this is intentional).

time Country Value


1582614000 Country1 0
1582614000 Country2 0
1582614000 Country3 0
1582614000 Country4 0
1582614000 Country5 0
1582614000 Country6 0
1582614000 Country7 2
1582614000 Country8 0
1582614000 Country9 0
1586498400 Country1 246
1586498400 Country2 366
1586498400 Country3 2192
1586498400 Country4 2085
1586498400 Country5 1143
1586498400 Country6 1468
1586498400 Country7 3045
1586498400 Country8 801
1586498400 Country9 1925
1586584800 Country1 255
1586584800 Country2 373
1586584800 Country3 2213
1586584800 Country4 2109
1586584800 Country5 1154
1586584800 Country6 1499
1586584800 Country7 3176
1586584800 Country8 819
1586584800 Country9 1963

What I want to achieve is multiple things.

  1. a graph that sums the country values for each day over time
  2. a graph that shows each individual country over time
  3. difference caluclations (sum of today minus sum of yesterday)

I can get the sum overall as a singlestat with this query:

select sum(“last”) from (select last(“Value”) from measurement group by “Country”)

But I can’t for the life of me get a query that makes Grafana create a time series graph.
I believe it might have to do something with the $timeFilter or WHERE time >= now() - 30d command?
Because every time I try this condition in InfluxDB it comes up empty.

I tried

Select “Value” from measurement group by “Country”

The query works in InfluxDB but this results in a “data outside time range” error and no graph in Grafana.

I also tried converting the timestamps to milliseconds, but to now avail. Every “WHERE time >= now() -30d” query comes up empty. Even when adding “explain” in front of it the query plan is blank.
I’m kind of lost now. No idea how to proceed.
Any help would be much appreciated.

Hopefully Country is a tag, so in the easy mode of query entry you will want something like this one I use, but with Country = Country1 instead of room = and obviously the appropriate mesurement, field, and alias.
image

Yes, country is a tag and value a field.

I found the solution: save timestamps in nanoseconds.
Apparently InfluxDB is not capable of calculating time ranges when time is not stored in ns but in s.

Very annoying.

It depends how influx is configured whether it expects ns or ms, I think.