# Top list of count grouped by tag in grafana

**URL:** <https://community.influxdata.com/t/top-list-of-count-grouped-by-tag-in-grafana/9097>\
**Category:** Systems\
**Tags:** grafana\
**Created:** [March 20, 2019, 2:12pm UTC](https://community.influxdata.com/t/top-list-of-count-grouped-by-tag-in-grafana/9097 "2019-03-20T14:12:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Klingeleers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/benjamin_klingeleers/32/2666_2.png) [@Benjamin\_Klingeleers](https://community.influxdata.com/u/Benjamin_Klingeleers)\
**Post date:** [March 20, 2019, 2:12pm UTC](https://community.influxdata.com/t/top-list-of-count-grouped-by-tag-in-grafana/9097/1 "2019-03-20T14:12:55Z")

</div>

I currently display all idocs with the next query

SELECT count(entry\_status) FROM idoc\_entry WHERE $timeFilter and entry\_status=‘ERROR IN HYBRIS’ GROUP BY idoc\_number, time($\_\_interval)

this shows the amount of time each idoc had an ‘error in hybris’ entry\_status. But i want to change it it to only display the top 10 idocs with the most error in hybris counts.

I tried this in my influx db

SELECT idoc\_number, TOP(test,5) FROM (SELECT count(entry\_status) as test FROM idoc\_entry where entry\_status = ‘ERROR IN HYBRIS’ GROUP BY idoc\_number)  
name: idoc\_entry  
time idoc\_number top

* * *

0 0000000979532169 24  
0 0000000979532169 24  
0 0000000979532169 24  
0 0000000979532169 24  
0 0000000979532169 24

I tried using this in grafana with the timefilters added but its not working, query used:

SELECT idoc\_number, TOP(test,10) FROM (  
SELECT count(entry\_status) as test FROM idoc\_entry WHERE $timeFilter and entry\_status=‘ERROR IN HYBRIS’ GROUP BY idoc\_number, time($\_\_interval))

This is the result [Screenshot - c1663f62136d57c902c764a57f11ace9 - Gyazo](https://gyazo.com/c1663f62136d57c902c764a57f11ace9)

---

<div class="post-metadata">

**Author:** ![Benjamin\_Klingeleers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/benjamin_klingeleers/32/2666_2.png) [@Benjamin\_Klingeleers](https://community.influxdata.com/u/Benjamin_Klingeleers)\
**Post date:** [March 21, 2019, 1:12pm UTC](https://community.influxdata.com/t/top-list-of-count-grouped-by-tag-in-grafana/9097/2 "2019-03-21T13:12:50Z")

</div>

Could anyone help me out with this one?
