Calculate current sum value

I’m trying to calculate the current printed counts value from my dashoard, but I’m not sure how to make this, I’m getting all total pages printed in the life for the printer, but just I want to add a filter date to get just the actual

here I’m getting all total

SELECT last(“PageCount”) FROM “printer” WHERE (“hostname” = ‘Admin’) AND $timeFilter GROUP BY time($__interval), “hostname”


this value should be 46 not 85788, it like min - max = 46
honestly I’m not sure how to make this

this is the csv data

5/12/2022 14:03,85742
5/12/2022 15:02,85788

anyone can advice me will be great

This is a sql question not a grafana question. The query you posted does exactly what you are querying which is the last lage count

I found a way to get what I was looking for using SELECT difference(last("count")) and adding total function in a single stat



I getting the month to day value, thanks for reply. bro.