Time Range does not seem to be working for singlestat panel MYSQL

The time range does not seem to be working for the singlestat panel with MYSQL.

now-5m shows the same values as does Last 24 hours or 1 week. I am using a simple select query. The table has random numbers. The total function sums up all the values in the table regardless of the time range which I have selected from the top right time range dialog box. So does the average,Max or min functions.

Am I missing something, or is this a problem. Please advise.

Can you paste the query??

SELECT
UNIX_TIMESTAMP(time_sec) as time_sec,
value as value,
metric as metric
FROM test543;
the table has random numbers between the range 10 to 95. Under the values section, the stats “Total”, “Average”, “Min”,“Max” is taking the entire data set into consideration irrespective of the time rage which I am defining at the top, whether it is now-5m or Last 24 hours, etc.

Change for this:

SELECT
UNIX_TIMESTAMP(time_sec) as time_sec,
value as value,
metric as metric

FROM test543;
Where $___timeFilter(time_sec)

That worked !! Thanks a lot Daniel. :grinning:

Hi! I’m having almost the same problem, just that when I use timeFilter I get the error “Unknown macro __timeFilter”. Any help?