Histogram of daily summaries?

Hi.

I have seven Singlestat panels on a dashboard, showing me the number of phone calls processed each day for the past week.

The queries for these are:

select count(d) from (select distinct(callid) as d from mqtt_consumer where topic=‘Live’ and $timeFilter group by server)

The $timeFilter is different for each Singlestat panel (using the time range override):
today: now/d
yesterday: now/d shifted 1d/d
day before: now/d shifted 2d/d
etc…

I’d also like to have a histogram showing these daily numbers, going back over 1 month (or maybe 3 months, etc).

Can anyone suggest what query and time range settings I’d need to use to get a graph of these daily values going back over the past month?

Thanks in advance (I hope) :slight_smile:

Antony.

Replying to myself now that I’ve worked it out, just in case it’s useful for
anyone else…

The answer was pleasantly simple:

Add “group by time(1d)” to the end of the query, such as:

select count(d) from (select distinct(callid) as d from mqtt_consumer where
topic=‘Live’ and $timeFilter group by server) group by time(1d)

That then returns an array of values which display nicely as a histogram.

Antony.

1 Like