# Aggregation over multiple properties in python

**URL:** <https://forum.weaviate.io/t/aggregation-over-multiple-properties-in-python/3987>\
**Category:** Support\
**Created:** [September 5, 2024, 3:33pm UTC](https://forum.weaviate.io/t/aggregation-over-multiple-properties-in-python/3987 "2024-09-05T15:33:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![longspearfish](https://avatars.discourse-cdn.com/v4/letter/l/dec6dc/32.png) [@longspearfish](https://forum.weaviate.io/u/longspearfish)\
**Post date:** [September 5, 2024, 3:33pm UTC](https://forum.weaviate.io/t/aggregation-over-multiple-properties-in-python/3987/1 "2024-09-05T15:33:55Z")

</div>

### Description

Hi community! I tried to do aggregation with group by, and was looking for some examples on grouping by on multiple properties of a collection. However, I could only find examples where it groups by one property at a time, such as the one below -

```auto
try:
    collection = client.collections.get("Article")
    response = collection.aggregate.over_all(
        group_by=GroupByAggregate(prop="inPublication"),
        total_count=True,
        return_metrics=wvc.query.Metrics("wordCount").integer(mean=True)
    )

    for g in response.groups:
        print(g.total_count)
        print(g.properties)
        print(g.grouped_by)

finally:
    client.close()

```

I wonder if it is possible for us to do group\_by with multiple properties?

### Server Setup Information

- Weaviate Server Version: 1.25.11
- Deployment Method: docker
- Multi Node? Number of Running Nodes: 1
- Client Language and Version: Python 4.5.7
- Multitenancy?: No

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [September 5, 2024, 6:28pm UTC](https://forum.weaviate.io/t/aggregation-over-multiple-properties-in-python/3987/2 "2024-09-05T18:28:47Z")

</div>

hi @longspearfish!! Hope you are having a lovely week!

You can only group by one property at a time. 🙁

Check here a related issue/question on that:

> <https://github.com/weaviate/weaviate-python-client/issues/351>
>
> When passing a list of properties (containing more than one) to \`with\_group\_by()…\` the query execution results in an error. For example, with the final query being:
> 
> \`\`\`
> {Get{Class(nearText: {concepts: \["credit card"\]} groupBy:{path:\["product\_group","product\_name"\], groups:3, objectsPerGroup:2}){\_additional {
> group {
> hits{
> section\_title
> information\_type
> content
> \_additional {
> id
> }
> }
> }
> id }}}}
> \`\`\`
> 
> The execution returns the following error:
> 
> \`\`\`
> {'data': {'Get': {'Class': None}},
> 'errors': \[{'locations': \[{'column': 6, 'line': 1}\],
> 'message': "explorer: get class: vector search: object vector search at index Index: shard Index\_: no such prop with name '' found in class 'Class' in the schema. Check your schema files for which properties in this class are available: unrecognized property: ",
> 'path': \['Get', 'Class'\]}\]}
> \`\`\`
> 
> It works well when passing a single property, but crashes when adding multiple.
> 
> The function docstring states the following: 
> \`\`\`
> properties: List\[str\]
> Properties to group by
> \`\`\`
> Meaning it should support multiple properties.
> 
> Am I missing something in how to correctly use \`with\_group\_by()\`?

Thanks!
