Add "GROUP BY" in filter for ORM query