How to query (Sum of 'value' for last 60minutes / Sum of 'value' for last 24 hours)

Hi I am new to this and I am using Influxdb with Grafana.

I have a data which gives a ‘value’ every minute. My goal is to create a query on Grafana which shows:

(Sum of ‘value’ for last 60minutes / Sum of ‘value’ for last 24 hours)

I guess it can be last 60 counts as well since I am getting value every one minute.

I have tried using three queries to achieve that but doesnt seem to work for me, can anyone help me with this please?

Update: I have been trying to use subqueries but it also doesn’t seems to work in current version of Grafana

Hello @pete00067,

Thanks for your question. What does your query look like so far?

Hi @Anaisdg, thank you for your reply.

My query currently looks like this:

SELECT SUM("deal",60)/SUM("deal",1440) FROM "autogen"."candlestick" WHERE $timeFilter GROUP BY "instrument"

However, it doesn’t seem to work at all.