Emmanuel Katto Dubai : Alternatives to Extracting Distinct Count in Aggregate Functions

Hi Everyone, I’m Emmanuel Katto from Dubai, When working with aggregate functions, I often need to calculate distinct counts. I’m curious if there are alternative methods or approaches to achieve this beyond the usual functions or techniques.

Does anyone have experience with different strategies for extracting distinct counts effectively? Any recommendations or tips would be great!

Regards
Emmanuel Katto

Hi!

You need to use aggregate for that:

for example, in this recipe:

response = collection.aggregate.over_all(group_by="source")
for group in response.groups:
    print(group.grouped_by.value, group.total_count)

Let me know if this helps!