order_status = "Invoiced" and payment_status != "Paid" and due_date < "30 days ago"
Note, that instead of payment_status = "Unpaid", I have used payment_status != "Paid". This is because we have another status of “Part paid” which if you have any invoices in this status are probably useful to see. The != means “not equal to”, so “show me invoices not paid” is slightly more encompassing than “show me unpaid invoices”. I hope this makes sense and is useful.
Ah yes, again this is slightly confusing, to be honest…
The “Invoices Due Date” field is the number that goes in conjunction with the “Invoice Due Date Option”. These fields match up with the fields you see when adding/editing a customer to define their payment terms, but like you say they tell you how the date was calculated, but not the actual date. The “Invoice Due Date Option” field looks like the below screenshot, which hopefully helps explain it a bit better.
In your case, the date formatted field for the actual payment due date for any given invoice is the one named just “Due Date”, this one should be usable with a relative date to today (or a specific date), like below:
due_date < "30 days ago"
or
due_date < "09/02/2022"
That should do what you need, but do please let us know if you’ve any trouble! Cheers.
Came across this topic as I am building a similar report, but I get an error message when I apply these filters:
order_status = “Invoiced” and payment_status != “Paid” and due_date < “30 days ago”
The error message is: There was a problem with the BrewwQL. Please double-check that it is valid. We could not parse the date or relative time of ‘30 days ago’.
Thanks for the question, Joost, and sorry for the confusion.
In Breww date formatting/parsing is aware of your location and should be formatted/translated for your language (even though most of Breww is still only in English). You should be able to use the “30 days ago” part in Dutch, like this:
order_status = "Invoiced" and payment_status != "Paid" and due_date < "30 dagen geleden"