I am trying to execute Aggregation Query and my code:
TicketGroup.objects.filter(event=event).aggregate(
total_group=Sum(F('total_sold')*F('final_price')))
I have "total_sold" and "final_price" in the TicketGroup object, and all I want to do is add and multiply values to get the total sales of all TicketGroups together.
All I get is an error:
The expression contains mixed types. You must set output_field
What am I doing wrong since I call "total_group" as my output field?
Thank!
source
share