# Obsidian Dataview — Queries Worth Keeping

Dataview turns your vault into something you can actually query. After months of tweaking, these are the queries I use constantly — not the ones I bookmarked and forgot.

## Dataview Queries I Use Daily

### Notes created in the last week

```dataview
TABLE file.ctime AS "Created"
WHERE file.ctime >= date(today) - dur(1 week)
```

This goes in my dashboard. Swap `1 week` for `1 month` when I want a broader view. Add `FROM "folder"` to scope it down.

### All my unfinished tasks, grouped by note

```dataview
TASK
WHERE !completed
GROUP BY file.link
SORT rows.file.ctime ASC
```

This is basically my task manager. I stopped using a separate todo app after building this.

### Tasks due today (for daily notes)

```dataview
TASK
WHERE due = this.file.day
```

Drop this in your daily note template. It pulls tasks whose due date matches the note's date — so each day's note automatically shows what's due.

### Listing every note with a given tag

```dataview
LIST FROM #project
SORT file.mtime DESC
```

Replace `#project` with whatever tag you're tracking.

## Tasks Plugin Queries

If you use the Tasks plugin (separate from Dataview), it has its own syntax that's cleaner for task-specific views:

```tasks
not done
due before 2 days after the current date
hide due date
hide priority
hide created date
hide backlink
sort by due date
```

And a minimal daily view:

```tasks
due on today
short mode
sort by priority
sort by tag
```

## Dataview Syntax in 30 Seconds — TABLE, LIST, TASK, WHERE

Four view types: `TABLE`, `LIST`, `TASK`, `CALENDAR`. Filter with `FROM` (folder) and `WHERE` (conditions). Sort with `SORT`. That's 90% of what you need.

For deeper stuff: [Dataview Beginner's Guide](https://obsidian.rocks/dataview-in-obsidian-a-beginners-guide/) and [Dataview with Tasks](https://www.lazysnail.net/obsidian/Obsdian-dataview-tasks).

## See Also

- [Organizing an Obsidian Vault](/articles/organizing-obsidian-vault) — get the structure right first, then query it
- [Tasks vs Goals vs Projects](/articles/tasks-vs-goals-vs-projects) — the system these queries power
- [The Productivity Trap](/articles/the-productivity-trap) — on not over-engineering the query setup itself
- [Oh My Zsh Plugins](/articles/oh-my-zsh-plugins)
