My online marketing department uploads analytical statistics on our marketing programs and we've always kept records in Excel. I've built an application to replace Excel and highlighting cells and adding functions to them was easy. The only thing I can't figure out is how to calculate and display the difference from one query to another. I apologize if I am not asking it correctly, I've included as image to help explain. Ultimately I would like to use a custom filter that will know how to calculate similar objects. All the code I looked at to try and figure it out is still a bit over my head. Any assistance or push in the right direction would be awesome. Thank you.
My View
t_2014 = traffic.filter(created__year='2014')
...
wd1 = t_2014.filter(created__week_day=1).aggregate(Sum('sessions'), Sum('new_users'), Sum('reminder'), Sum('campaigns'), Sum('new_sales'), Sum('sales_renewals'))
wd2 = t_2014.filter(created__week_day=2).aggregate(Sum('sessions'), Sum('new_users'), Sum('reminder'), Sum('campaigns'), Sum('new_sales'), Sum('sales_renewals'))
...
t_new_sales_2014_wd1 = wd1.get('new_sales__sum')
t_new_sales_2014_wd2 = wd2.get('new_sales__sum')
...
My Template
<td>{{ t_new_sales_2014_wd1 }}</td>
...
<td>{{ t_new_sales_2014_wd2 }}</td>
...
