﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20930	Arithmetic operations on aggregates	Debanshu Kundu		"In many cases one may require to do simple arithmetic operations (+, -, *, /) on aggregated (with numbers or other aggregates).
Eg. For model `Xyz`:

{{{
class Xyz(models.Model):
    a = models.IntegerField()
    b = models.IntegerField()
}}}

If I want to find percent ratio of sum of all `a` and sum of all `b`, I can write:

{{{
Xyz.objects.aggregate(ratio_percent=Sum('a')/Sum('b')*100)
}}}

This type of functionality has been implemented in this commit https://github.com/debanshuk/django/commit/722f7a4a17870fe1ffb6c207153d1fca6388a401

More operations (like pow) can also be added."	New feature	closed	Database layer (models, ORM)	dev	Normal	duplicate	aggregate, annotate	Debanshu Kundu jorgecarleitao@…	Accepted	1	1	1	1	0	0
