Transaction.objects.all().values('actor').annotate(total=Count('actor')).order_by('total') Transaction.objects.all().values('actor').annotate(total=Count('id')).order_by('total')