# \[GitHub\] Tracking zero counts

**URL:** <https://discuss.dgraph.io/t/github-tracking-zero-counts/8865>\
**Category:** Dgraph\
**Tags:** dgraph, status:accepted, area:querylang, priority:p3, area:indexes\
**Created:** [April 5, 2020, 11:37am UTC](https://discuss.dgraph.io/t/github-tracking-zero-counts/8865 "2020-04-05T11:37:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [April 5, 2020, 11:37am UTC](https://discuss.dgraph.io/t/github-tracking-zero-counts/8865/1 "2020-04-05T11:37:57Z")

</div>

**Moved from GitHub [dgraph/5114](https://github.com/dgraph-io/dgraph/issues/5114)**

_Posted by_ [mehdiym](https://github.com/mehdiym):

Hello,

When using the count index at the query root, I regularly need to get values lower than a threshold, **including** zero.

For instance, suppose I have products connected to suppliers and I’d like to known when there are not enough suppliers. I could use the following query:

```auto
{
  me(func:lt(count(supplier), 3)) {
    uid
    product_name
  }
}

```

But I will miss the products with 0 suppliers: the most important ones to me.

I could use a second query block with a filter not has(supplier) but it is no efficient as not using any index.

What about adding an option on @count index to also track 0 counts?  
It could be tracked only for the types containing the predicates with those indexes.

For example :

```auto
type Product {
  supplier
}
supplier: [uid] @count(zero) .

```

Original forum thread: [Tracking zero counts](http://discuss.hypermode.com/t/tracking-zero-counts/6235)

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [April 15, 2020, 8:53pm UTC](https://discuss.dgraph.io/t/github-tracking-zero-counts/8865/2 "2020-04-15T20:53:46Z")

</div>

[lgalatin](https://github.com/lgalatin) _commented_ :

I am accepting it for now which means we will work on it if it gets high priority. will keep you posted.

---

<div class="post-metadata">

**Author:** ![diggy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/diggy/32/3666_2.png) [@diggy](https://discuss.dgraph.io/u/diggy)\
**Post date:** [April 21, 2020, 11:02pm UTC](https://discuss.dgraph.io/t/github-tracking-zero-counts/8865/3 "2020-04-21T23:02:42Z")

</div>

[lgalatin](https://github.com/lgalatin) _commented_ :

This was given low priority for now, would you please let us know if the suggestions given in the discuss post work for you?
