Group by month and sum it in views

I have daily transaction datas, and has multiple mode of payments.
I wish I can sum by mode of payment and group it by months.

I have uploaded an image file, what I want to achive.
Below are my view and template

def bymonth(request):
	ms = {
		'monjc': Daily.objects.aggregate(mjc=Sum('transamount', 
			filter=Q(transdate__month=1) & Q(transmode__name='Cash')))['mjc'],
				'monfc': Daily.objects.aggregate(mfc=Sum('transamount', 
			filter=Q(transdate__month=2) & Q(transmode__name='Cash')))['mfc'],
		'monje': Daily.objects.aggregate(mje=Sum('transamount', 
			filter=Q(transdate__month=1) & Q(transmode__name='ENBD')))['mje'],
		'monfe': Daily.objects.aggregate(mfe=Sum('transamount', 
			filter=Q(transdate__month=2) & Q(transmode__name='ENBD')))['mfe'],		
	return render(request, 'bymonth.html', ms)
<table border="1">
	<td>{{ monjc | floatformat:'2g' }}</td>
	<td>{{ monfc | floatformat:'2g' }}</td>	
	<td>{{ monje | floatformat:'2g' }}</td>	
	<td>{{ monfe | floatformat:'2g' }}</td>		
	<td>Pay IT</td>


In the template I want to have the months only which are available in the data.
For Example: I have datas only upto this month ( May )
It will be growing daily, wish to have dynamic displaying of months in the template.
Please guide.

And my current output is as below, help me to improve


It has been seven days, no one replied
usually experts here reply, don’t what happen

For the aggregation of your data, take a look at this topic: sum a grouped data

It’s an exact parallel to what you’re trying to do here and should give you some ideas.

Thanks, Will look and try