Dataview is an incredibly powerful plugin that allows you to filter data in your Obsidian vault in a lot of really cool ways. In this post, I’m going to show you how I use it to create a table of book ratings from YAML metadata.
Don’t worry, it’s not as complicated as it sounds. Here’s a video that walks you through the whole process:
If you prefer the written version, read on.
How Dataview works
The best way to explain the Dataview plugin is to show an example. One of the ways I use it is to create a table of all of the ratings from the Bookworm podcast that I do with Joe Buhlig. We read a book every two weeks, we talk about what we got out of it, and we give the book a rating. Using Dataview, I can compile all of the ratings into a table.
So to start, I have a note in my Obsidian Vault for every single episode of bookworm. To add the rating, I simply add the YAML frontmatter metadata in Edit Mode like so:
(your YAML text)
Here’s what it looks like side-by-side in Edit Mode and Preview Mode:
In this particular example, I have three pieces of metadata:
- The tag bookworm
- Joe’s Rating (4.0)
- My rating (4.0)
(In the podcast, we rate books from one to five stars, similar to the Amazon ratings. So this particular book, Joe gave it 4 stars, and I gave it 4 stars.)
Now from this point, we’re going to create a new note and use the Dataview plugin to create a table of all of these ratings in the new note. So the first thing we need to do is to install the Dataview plugin.
To install the plugin, click the Gear to access the Settings:
Then go to Community Plugins and click Browse:
Search the Dataview plugin. Once you find it, click Install and then Enable.
Note that in the plugin description, they give you a lot of other examples of how you might want to use this.
Now we can close the Settings and go back to our new note, Bookworm Ratings, and add the following code:
table Joe, Mike
sort Mike desc
The three backticks are the Obsidian formatting for code snippets, and everything inside is telling the Dataview plugin what to do. Here’s a description of what’s going on here:
dataviewtells Obsidian to use the Dataview plugin
- table Joe, Mike tells Dataview to create a table with values from Joe & Mike from the YAML section of the desired files
- from “Bookworm” tell Dataview to include all files from the Bookworm folder
- sort Mike desc says to sort everything in descending order by the values in the Mike column
That’s all we have to do. Now when we click the Preview button, Dataview will render a table of ratings based on the values in the YAML metadata. Here’s a side-by-side screenshot of the code in Edit Mode and the table in Preview Mode:
But this is just one example of how you might use this incredible plugin. There are lots of other great examples over at the Obdisian forum if you need some additional inspiration.
Coming Soon: A New Course On Building Your PKM
We’re working on something new that will help you set up your Personal Knowledge Management (PKM) system using Obsidian.
Want to be the first to know when it’s ready? Let us know. We’ll also be sending out behind-the-scenes details along the way, just for those on the list.