How to get number in counter query with grafana?

I am using query counter query that do total

How I can use the Time range controls of grafana to my query ?
meaning when I change it for 5 minute I want to get the result from 5 minute until now

for example in 5 minute the total is 20
and now the total is 30
so i want to change it in grafanaand to get the number 10

You should explore using transformations. They are very good at this sort of thing: