[DataView](https://blacksmithgu.github.io/obsidian-dataview/) is a powerful plugin for querying your notes and returning the results as a table, list, or calendar. DataView can also quickly pull all tasks into one place. Results are returned as markdown in you note.
To create a query, start with a code block (three backticks) and set the language as `dataview`.
For a quick overview of everything you can do with DataView, check out this [Beginners Guide to Dataview](https://obsidian.rocks/dataview-in-obsidian-a-beginners-guide/).
## Periodic notes
I use dataview extensively in periodic notes to move content automatically from days to weeks to months. For this to work, my periodic notes must be formatted in the following way:
- Daily notes are formatted as valid dates (e.g., YYYY-MM-DD)
- Weekly notes are for a numbered week (Mon - Sun)
- Weekly notes have "W" (only one) followed by the numbered week
### Weekly Note
In each daily note I can capture tasks I want to do that day. If they don't get done (aren't checked off in the daily note), I can forward them to my weekly note with this dataview query which is stored in the weekly note template.
```
task
from "per/day"
where !completed and file.day.weekyear = number(split(this.file.name, "W")[1])
group by file.link
```
The inspiration for this setup comes from [this forum](https://forum.obsidian.md/t/tasks-query-tasks-completed-in-weekly-monthly-quarterly-notes/43968/3)
For monthly notes in format “yyyy-MM” (ex.: 2022-09)
try something like:
` # monthly completed tasks
```dataview TASK WHERE dateformat(file.day, "yyyy-MM") = this.file.name WHERE !completed``` `
For Quarterly notes in format “yyyy-[Q]q” (ex.: 2022-Q3) try this:
` # Quarterly completed tasks
```dataview TASK WHERE dateformat(file.day, "yyyy-'Q'q") = this.file.name WHERE !completed ``` `
Explaining:
- `WHERE file.day.weekyear = number(split(this.file.name, "W")[1])`
- `file.day` it’s an implicit date if the note title has a valid date in it. For the case, `2022-09-25 Sun`, it extract the date `2022-09-25`.
- `file.day.weekyear` - extract the week-of-the-year from the valid date, in case the number `38`
- `split(this.file.name, "W")[1]`- now I take the file name of the current file (`2022-W38`) and extract the number after the “W”
- `number(split(this.file.name, "W")[1])` - because the `split()` results are strings, we need to use the function `number()` to transform the string “38” in the number 38.
- `WHERE file.day.weekyear = number(split(this.file.name, "W")[1])` - now we define the filter condition: «only files where the number of the week-of-the-year date is equal to the week number we extract from the current weekly note title.
- `WHERE completed` - filter only completed tasks
## Inline properties
Inline properties allow you to add a property anywhere in the document, not just in the YAML metadata. These properties are queryable like metadata properties but more flexible.
An example application is to capture notes for specific people in, say, a meeting note. For example, create a note `Erik Anderson.md` and in any other file type
"ErikAnderson:: has a cat" to pull that into the file.
Here's a query to pull all mentions of a person into their personal note (just add `dataviewjs` to the code block header).
```
const personString = dv.current().file.name.split(" ").join("");
dv.list(dv.pages("").where(p => p[personString]).map(p => {
if (typeof p[personString] === "string") {
return p.file.link + ": " + p[personString]
} else {
return p.file.link + p[personString].map((item, index) => {
return "\n" + "- " + p[personString][index]
})
}
}))
```
You can use emojis as inline properties. I experimented with using the ✨ emoji to indicate an idea that I want to aggregate in a single note. However, note that you must wrap the statement in square brackets.
See [adding metadata](https://blacksmithgu.github.io/obsidian-dataview/annotation/add-metadata/#field-shorthands) in the dataview documentation for more.
## Settings
### Inline Query Prefix
To prevent Dataview from attempting to execute code blocks that start with an equals sign ( `=` ), such as Excel or Google Sheets formulas, change the Inline Query Prefix in Dataview settings to a different character. I use the combination of hashtag (`#`) and equal sign (`=`).

Note that you cannot just disable inline queries, as Dataview will render `disabled` rather than ignore the inline query prefix.
> [!Tip]- Additional Resources
> -