# django aggregate sum?

**URL:** <https://forum.djangoproject.com/t/django-aggregate-sum/19752>\
**Category:** Using the ORM\
**Created:** [March 24, 2023, 2:49am UTC](https://forum.djangoproject.com/t/django-aggregate-sum/19752 "2023-03-24T02:49:43Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [March 24, 2023, 1:04pm UTC](https://forum.djangoproject.com/t/django-aggregate-sum/19752/3 "2023-03-24T13:04:51Z")

</div>

I’m not understanding how you’re obtaining those results from the data you’ve provided.

Specifically, this result -

> [@Pisych72](#):
>
> Product **2** , price =5, total\_quantity =10, **id\_prod=1**

I don’t see how you get this from:

> [@Pisych72](#):
>
> Product 2, price =5, quantity =10, **id\_prod=2**

[emphasis added]

Was this just a typo?

Assuming that that is a typo, you’re looking for something like:  
`Product.objects.values('name', 'id_prod', 'price').annotate(total=Sum('quantity'))`

---

_[View the full topic](https://forum.djangoproject.com/t/django-aggregate-sum/19752)._
