Cannot figure out how to use @groupby in custom DQL

I’ve got it working now! The problem was that the DQL query and GraphQL query names didn’t match.
Now if only the sorting would work…

In Custom DQL it says:

The name of the DQL query that you want to map to the GraphQL response, should be same as the name of the GraphQL query.

type PropertyMap @remote {
    brand: String @remoteResponse(name: "Stems.brand")
    count: Int
}

type GroupPropertyMap @remote {
    groupby: [PropertyMap] @remoteResponse(name: "@groupby")
}

type Query {
  queryPropertyKeyMap: [GroupPropertyMap] @custom(dql: """
    {
    queryPropertyKeyMap(func: type(Stems)) @groupby(Stems.brand) {
      count(uid)
    }
    }"""
  )
}