Habits are the building blocks of our lives. They shape our routines. Whether it’s hitting the gym every morning, reading half an hour before bed, or as simple as drinking a glass of water first thing in the morning, habits define who we are.
Habits define where we will lead our life.
However, creating new habits is hard. Especially in today’s world where we are faced with so many distractions and temptations, it’s easy to fall off the grid.
That’s where habit tracking comes in.
Tracking our habits can help us gain valuable insights into our daily behaviors and stay motivated toward achieving our goals.
It can help us maintain consistency in our routines and lead a more fulfilling and productive life.
In this article, we will set up a simple habit-tracking dashboard within Obsidian.
- Daily Notes: This is where all of our data will be stored.
- Templates/ Templater: We’ll create a template for our daily notes.
- Dataview: Dataview will be used to visualize our habits.
Tracking our habits
To track our habits, we’ll use daily notes. For this, we’ll use our habits as metadata. We add metadata to our notes either in the YAML frontmatter or we can add it as inline metadata in our notes with “::”.
Here’s a simple habit tracker metadata that includes sleep, reading, exercise, meditation, and writing.
We add these habits by adding corresponding numbers to the metadata value.
For example. we can note down the number of minutes we read or the number of pages we read, the number of words we wrote, or any other relevant data for tracking these habits.
Similarly, you can add a habit you are trying to build to track here.
Visualizing your habits
Once you have set up a track, it’s time to visualize your habits. This is where the powerful Obsidian plugin Dataview comes in.
Create a new note called habit tracker and add the following Dataview query:
TABLE WITHOUT ID
file.link as Date,
choice(Sleep > 7, "🟩", "🟥") as 🛌,
choice(Exercise > 30, "🟩", "🟥") as 🏃,
choice(Reading > 30, "🟩", "🟥") as 📚,
choice(Meditation > 10, "🟩", "🟥") as 🧘,
choice(Writing > 750, "🟩", "🟥") as ✍️
WHERE file.day <= date(now) AND file.day >= date(now) - dur(7days)
SORT file.day ASC
In this query, we added a Dataview query that displays the habit’s progress for the past 7 days. We can change the time duration as per our preference.
This is what’s happening in the Dataview query:
Firstly, a Dataview table is generated from notes containing the #dailies tag.
Let’s use a Writing query as an example.
Assume your goal is to write 750 words every day. If your writing data in your daily note falls below 750, the Dataview table will display a red box indicating that the task is incomplete.
If your writing data exceeds 750, then you have met your goal.
You can include other habits and utilize different data to set goals for these habits according to your individual preferences.
Here’s how the habits will be visualized. Currently, no data is added for habits. That’s why all habits are represented as a red box.
Found this helpful? Join my email-list.