Dataview all active projects whose deadline is until/before a certain date

I want to set up a dataview table with all my projects whose deadline is until a certain date from now.

I use inline dataview parameter like this
deadline:: "2021-10-01"

Now, let say I want to search for all projects that have a deadline 30 days from now. How would a dataview query that search for that look like?

Any help is very much appreciated!

I don’t know if you need others WHERE conditions (because you mention “active projects”), but for the main question try this:

  • deadline in days
```dataview
TABLE dateformat(deadline, "yyyy.MM.dd") AS "Next 30 days"
WHERE deadline - date(today) <= dur(30 days)
SORT deadline ASC
```
  • deadline in months
```dataview
TABLE dateformat(deadline, "yyyy.MM.dd") AS "Next 30 days"
WHERE deadline - date(today) <= dur(1 month)
SORT deadline ASC
```

I get this error report:

Dataview: Every row during operation 'where' failed with an error; first 3:
- Operator '-' is not supported for 'null' and 'date
- Operator '-' is not supported for 'string' and 'date
- Operator '-' is not supported for 'null' and 'date

Perhaps the issue is in the way you input the date format.
I’m not sure about it, but if you use deadline: "2021-10-01" in frontmatter field, I think dataview is able to read it as a date format. But if you use deadline:: "2021-10-01" as an inline field, I think dataview read it as a string (because " ") not as a date.
Try to change in one or two notes the inline date format, removing " ", and test the query again.

1 Like

You’re right! It works like a charm now.

Thank you very much!!!

every interesting, can dataview recognize such time duration too? I want to make a field for it and filter the results by it too. can i make it realize it is time?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.