I've got a transaction model:

```
class transaction(models.Model):
    transactiondate = models.DateField()
    details = models.CharField(max_length=200, null=True)
    amount = models.DecimalField(decimal_places=2, max_digits=10)
    accountid = models.ForeignKey(account, on_delete=models.PROTECT)

```

I'm trying to get a running total balance for each date so that I can plot the last 12 months balance on a line chart. My query is:

```
transaction.objects.annotate(
            balance=Window(Sum('amount'), order_by=F('transactiondate').asc())).filter(transactiondate__gte='2021-01-01')

```

The problem is that this isn't including data prior to 2021-01-01 in the calculation. I want the Sum to include all transactions regardless of date but I only want to see 12 months in my chart. I thought that tagging on the filter after the aggregate would calculate the correct balance first and then apply the filter to only give me 12 months, but that's not what's happening. If I remove the filter then I get the correct balance, but my line chart is unreadable with so much data.

Is there a way to filter the data after aggregation?