Trying and failing to Aggregate Records with the following criteria...

Trying and failing to Aggregate Records with the following criteria...

Here's my code:

input.Spend = Credit_Cards[(TYPE == "Ad Spend" && PURCHASE_DATE.getMonth() == input.Date_field.getMonth())].sum(AMOUNT);

This doesn't work. Can you tell me how to check the Credit_Cards PURCHASE_DATE field against the parent form's Date_field?