Updating stat value depending on time range giving in grafana dashboard

So at the moment I have a stat panel that is pulling a large range of data from a single column in a MYSQL database. Using the “calculation” option in grafana I have selected “Total” which is providing a total combined price of all the values from this MYSQL table. I was wondering is it possible to have this stat panel perform the total calculation on the data selected from the time frame in the dashboard. As depicted in the image below I want the total combined prices from any values pulled in the last 3 hours (where instead it is just providing a total of all the values in the MYSQL database).


Please check this thread :

You need to use the $_timefilter in your query to restrict the values.

Hope it helps.

Good Luck