I user Grafana and to count closed here is the example code
Select concat(firstname, ’ ',lastname) as metric, count(t.state_id) as value, now() as time
from tickets as t
join users on users.id=t.owner_id
where t.state_id = 4 and age(now(),t.close_at) < ‘12 hours’
and users.id != 1
group by metric
Yes, im using Postgress also. Think my problem is probably not the query, more likely how I should configure Granfana. I will do some deeper investigation.