MAX, MIN and AVG. does not match time range set in dashboard

Hi

Hope someone can help me, as the title startes i am trying to figure out a way to change the max, min and avg. stats depending on the time range you are looking at.

We are using mysql as a source. i have looked at this so far:

It migth well be me not getting how the query functions i hope someone can point me in the rigth direction.

this is my current query:

SELECT
timestamp AS “time”,
“totalTrafficIn” AS metric,
value
FROM DATABASE
WHERE
name = “totalTrafficIn”
ORDER BY “timestamp” desc

And this is what i thought would work:
SELECT
timestamp AS “time”,
“totalTrafficIn” AS metric,
value
FROM DATABASE
WHERE
name = “totalTrafficIn” and
$__timeFilter(timestamp)
ORDER BY “timestamp” desc

When trying that i get no data at all, have tried setting the time range to past year and still nothing.

when looking at the timestamp collum i see the following data: 1584628081
So as far as i can see its a normal unix timestamp.

1 Like

Commenting because I have the same exact question! In my case it’s with SQLite but still would love to know how to handle it with any DB.