Hello. I have the following schema

```
title: string @index(term) .
term: string @index(term) .
category: string @index(term) .
has_category: uid @reverse .
has_term: [uid] @reverse .
type Category {
category
}
type Term {
term
}
type Article {
title
has_category
has_term
}
```

With the following relationships:

- Article → (has_category) → Category
- Article → (has_term with has_term|appears facet) → Term

What I am trying to achieve is map back from a list of terms to their categories. Once I have that, I want to groupby term + category to calculate total sum of **appears** facet.

The closest I got is:

```
query main($text: string){
q(func: anyofterms(term, $text), first: 2) @filter(eq(dgraph.type, "Term")) {
term: term
~has_term @normalize {
title
has_category {
category:category
}
appears: val(a)
} @facets (a as appears)
}
}
```

Which returns:

```
[
{
"term": "anyon",
"~has_term": [
{
"appears": 1,
"category": "Health"
},
{
"appears": 3,
"category": "Health"
},
]
}
]
```

I can’t seem to find a way to make those entries of **Health** be summed together