Obsidian Tasks query: recently-added tasks

Things I have tried

I’ve tried various tasks and dataview queries, but I’m probably missing something.

What I’m trying to do

I use the excellent Tasks plugin, and would like to have a query to show me incomplete tasks that I created in the last “n” days.

Something like:

TASK WHERE incomplete
AND file.mtime >= date(today) - dur(2 day)
SORT file.mtime Desc

Creation and modification dates are by default only related to actual files.

If you want that applied to tasks as well, then you need to add dates to the actual tasks, and reference those dates in your queries. I don’t think that’s a viable way, unless you are auto-creating tasks, or something like that.

So the query you’ve written does return any tasks from files that has been modified the last 2 days. The error in that query is incomplete. Try with either !completed or status = " ". You’re not guaranteed that it’s the tasks which have changed, it could very well be that some other text that has changed. But if a task has changed, that query would pick up that as well as other changes.

Got it, thanks very much.

I suspected that Tasks doesn’t track creation time, which is a shame.

1 Like

Follow-up:

I use this and it works pretty well:

TASK WHERE !complete
AND contains(tags, "#task")
AND file.mtime >= date(today) - dur(2 day)
SORT file.mtime Desc
GROUP BY file.link

But it shows COMPLETE tasks as well as the incomplete ones.

Any idea how I can adjust this query to filter out the completed tasks?

Thanks!

Try !completed

1 Like

Thanks, works great! Can’t believe I missed that.

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