aggregate filter
Makes it possible to add a filtering condition directly after the aggregate function (or possible, `aggregate(expression) WITHIN GROUP (ordering clause)`. This is mostly useful if the annotation has two or more expressions, so it's possible to compare the result with and without the applied filter; it's more compact than using `Case`. It's suggested to add `values` to the queryset to get a proper group by. Usage example: `books = Book.objects.values('publisher__name').annotate( count=Count('*'), filtercount=Filter(expression=Count('publisher__name'), condition=Q(rating__gte=5)) ) ` Supported on Postgresql 9.4+. Possible other third-party backends.
- filter
- postgresql
- olap
- aggregate
- expression