Dataview Plugin Guide
Transform your Obsidian vault into a powerful queryable database with the Dataview plugin.
What is Dataview?
Dataview is one of the most powerful Obsidian plugins that treats your vault as a database. It allows you to:
- 📊 Query your notes using SQL-like syntax
- 📈 Create dynamic views and reports
- 🔍 Filter and sort content automatically
- 📉 Generate statistics and visualizations
- ⚡ Update in real-time as your notes change
Quick Start
Installation
- Open Obsidian Settings
- Go to Community Plugins
- Search for “Dataview”
- Install and enable
Your First Query
Create a new note and add this query:
TABLE date, mood
FROM "diary"
WHERE !draft
SORT date DESC
LIMIT 5
This displays your 5 most recent diary entries with their dates and moods.
Query Types
Dataview supports four main query types:
1. TABLE Query
Display data in table format:
TABLE date as "Date", mood as "Mood", weather as "Weather"
FROM "diary"
WHERE !draft
SORT date DESC
Use cases:
- Diary entry overviews
- Task lists with metadata
- Content summaries
2. LIST Query
Simple list format:
LIST
FROM "posts"
WHERE contains(tags, "tech")
SORT date DESC
Use cases:
- File listings
- Tag-based content
- Quick overviews
3. TASK Query
Display tasks from your notes:
TASK
FROM "todo"
WHERE status != "done"
GROUP BY priority
Use cases:
- Task management
- Project tracking
- Todo lists
4. CALENDAR Query
Visualize content on a calendar:
CALENDAR date
FROM "diary"
Use cases:
- Activity tracking
- Content calendar
- Habit visualization
Advanced Features
DataviewJS
For complex queries, use JavaScript:
const todos = dv.pages('"todo"').where(p => !p.draft);
const total = todos.length;
const completed = todos.where(p => p.status === "done").length;
const rate = Math.round((completed / total) * 100);
dv.paragraph(`**Completion Rate**: ${rate}% (${completed}/${total})`);
Inline Queries
Embed queries inline within your text:
Today I have `= this.todos.length` tasks pending.
Custom Functions
Use built-in functions for data manipulation:
length()- Count itemscontains()- Check for valuesdate()- Date operationsdur()- Duration calculations
Practical Examples
Personal Dashboard
Create a comprehensive overview:
# 📊 My Dashboard
## Today's Tasks
```sql
TASK
FROM "todo"
WHERE dueDate = date(today) AND !draft
Recent Diary Entries
TABLE date, mood, weather
FROM "diary"
WHERE !draft
SORT date DESC
LIMIT 5
Project Progress
const projects = dv.pages('"projects"').where(p => !p.draft);
const active = projects.where(p => p.status === "active").length;
const completed = projects.where(p => p.status === "done").length;
dv.paragraph(`Active: ${active} | Completed: ${completed}`);
### Weekly Review
Analyze your week's activity:
```javascript
const startOfWeek = dv.date("today").startOf("week");
const thisWeek = dv.pages('"diary"')
.where(p => p.date >= startOfWeek && !p.draft);
dv.header(2, "This Week");
dv.list([
`Diary entries: ${thisWeek.length}`,
`Active days: ${new Set(thisWeek.map(p => p.date.day)).size}`,
`Words written: ${thisWeek.map(p => p.file.size).reduce((a,b) => a+b, 0)}`
]);
Tag Statistics
Analyze your content tags:
const allPages = dv.pages().where(p => !p.draft);
const tagCounts = {};
allPages.forEach(page => {
if (page.tags) {
page.tags.forEach(tag => {
tagCounts[tag] = (tagCounts[tag] || 0) + 1;
});
}
});
const sorted = Object.entries(tagCounts)
.sort((a, b) => b[1] - a[1])
.slice(0, 10);
dv.table(["Tag", "Count"], sorted);
Best Practices
Performance Tips
- Use specific paths:
FROM "diary"instead ofFROM "" - Filter early: Use
WHEREbeforeSORT - Limit results: Add
LIMITto large datasets - Index frequently: Keep frontmatter consistent
Query Organization
- Comment your queries: Explain complex logic
- Use variables: Make DataviewJS readable
- Test incrementally: Build queries step by step
- Create templates: Reuse common patterns
Common Patterns
Date-based queries:
WHERE date >= date(today) - dur(7 days)
Multi-condition filters:
WHERE (priority = "high" OR priority = "medium")
AND status != "done"
AND !draft
Grouping and counting:
TABLE WITHOUT ID
category,
length(rows) as "Count"
GROUP BY category
Integration with Other Plugins
Templater Integration
Use Templater to auto-insert Dataview queries:
---
creation_date: <% tp.date.now("YYYY-MM-DD") %>
---
## Recent Activity
```sql
TABLE file.name, creation_date
FROM ""
WHERE creation_date >= date(today) - dur(7 days)
SORT creation_date DESC
### Calendar Integration
Visualize diary entries on calendar:
```sql
CALENDAR date
FROM "diary"
WHERE !draft
Live Demo
Want to see Dataview in action? Check out our interactive presentation:
📊 Interactive Dataview Demo
🎬 Full Dataview Presentation
View our comprehensive Dataview presentation that covers:
- Basic query syntax and types
- Real-world diary and todo examples
- DataviewJS advanced features
- Best practices and optimization
- Live examples and demonstrations
💡 Tip: Press F for fullscreen, S for speaker notes
Embed Live Demo
You can also view the presentation embedded below:
Troubleshooting
Common Issues
Query not showing results:
- Check file paths in
FROMclause - Verify frontmatter fields exist
- Ensure
!draftfilter is appropriate
Slow performance:
- Reduce query scope
- Add more specific
WHEREconditions - Use
LIMITto restrict results
Syntax errors:
- Check for missing quotes
- Verify function names
- Test DataviewJS in console
Resources
Documentation
Examples in This Project
/docs/obsidian-integration-examples- Complete examplestemplate/Dashboard.md- Personal dashboard templatetemplate/DATAVIEW-EXAMPLES.md- Query examples collection
Community Resources
Next Steps
- Install Dataview in your Obsidian vault
- Try basic queries from the examples above
- Watch the demo presentation for visual learning
- Build your dashboard using the template
- Experiment with DataviewJS for advanced features
Start small, query often, and gradually build your data-driven note-taking system!
Ready to make your notes work harder for you? Start querying with Dataview today!