I’m a little lazy, so it’s not tested, but does the following work:
```dataview
Table Closed
FROM "Tickets"
FLATTEN date(substring(Closed, 6) + "-" + substring(Closed, 3, 5) + "-" + substring(Closed, 0, 2)) as ClosedDate
WHERE Closed
GROUP BY dateformat(ClosedDate, "yyyy-MM")
```
This query does two major things:
- It only queries notes actually having the
Closed
field - It redefines the
Closed
field into a proper date, stored in theClosedDate
field
Your syntax of MM-dd-yyyy
is not recognised by dataview as a date. It should have been in the form yyyy-MM-dd
with the day begin optional, and I’ve left out the timestamps.
Given that it wasn’t recognised as a date, you couldn’t format it as a date either. So I would strongly recommend to go over your notes and use a proper date definitions, as that would make any query easier. Like this one you could write as:
```dataview
Table Closed
FROM "Tickets"
WHERE Closed
GROUP BY dateformat(Closed, "yyyy-MM")
```