How to Build a Notion Habit Tracker Database With Streak Counter
🔍 WiseChecker

How to Build a Notion Habit Tracker Database With Streak Counter

You want to track daily habits inside Notion and see your current streak for each one. A habit tracker database with a streak counter lets you log completions and automatically calculate how many consecutive days you have maintained a habit. This article explains how to set up a database with a rollup formula that counts your streak without manual updates.

Key Takeaways: Building a Notion Habit Tracker With Streak Counter

  • Two-database setup: A Habits database stores each habit name, and a Daily Log database stores one entry per day with a checkbox for each habit.
  • Relation and Rollup: Link the Daily Log to Habits via a relation property, then use a rollup to count consecutive checkboxes.
  • Formula for streak: A formula property in the Habits database uses the rollup value and a date comparison to show the current streak number.

ADVERTISEMENT

How the Notion Habit Tracker Database Works

The habit tracker uses two separate databases connected by a relation property. The Habits database contains one row per habit. Each row has a name, a formula for the streak count, and a rollup that pulls data from the Daily Log database.

The Daily Log database stores one entry per day. Each entry includes a date property and a checkbox for each habit you want to track. When you check a box, that day counts toward the streak for that habit. The streak formula looks at the rollup of checkboxes and calculates how many consecutive days have the box checked, counting backward from today.

Before you begin, you need a Notion workspace with database permissions enabled. You do not need any third-party integrations or paid Notion plan features. The formula uses only built-in Notion functions: prop, if, empty, dateBetween, and formatDate.

Steps to Create the Habit Tracker With Streak Counter

Step 1: Create the Habits Database

  1. Create a new database
    In your Notion workspace, click + New Page and choose Table. Name it Habits.
  2. Add a Name property
    The default Title property is already present. Rename it to Habit Name. Enter one habit per row, such as “Exercise” or “Read 20 minutes”.
  3. Create a Formula property
    Click + Add a property, select Formula, and name it Streak. Leave the formula field empty for now. You will fill it after the Daily Log is ready.
  4. Create a Rollup property
    Click + Add a property, select Rollup, and name it Checkbox Rollup. Do not set the relation yet. You will connect it after creating the Daily Log.

Step 2: Create the Daily Log Database

  1. Create a new database
    Click + New Page and choose Table. Name it Daily Log.
  2. Add a Date property
    Click + Add a property, select Date, and name it Date. This will store the day of each log entry.
  3. Add a Checkbox property for each habit
    For each habit you added in the Habits database, add a Checkbox property. For example, add a property named Exercise and set the type to Checkbox. Repeat for each habit. You can add checkboxes later as you add new habits.
  4. Add a Relation property
    Click + Add a property, select Relation, and name it Related Habit. In the relation settings, choose the Habits database as the target. Enable Show on Habits so the relation appears in both databases.

Step 3: Link the Databases

  1. Open the Habits database
    Go to the Habits table. You should see a new column named Related Habit that appeared automatically from the relation.
  2. Configure the Rollup property
    Click the Checkbox Rollup property header. In the settings, set Relation to Related Habit. Set Property to the habit checkbox you want to roll up. For example, if you are setting up the streak for “Exercise”, choose the Exercise checkbox property from the Daily Log. Set Calculate to Show original. This will display an array of checkbox values for all linked daily log entries.

Step 4: Populate the Daily Log

  1. Add entries for each day
    In the Daily Log database, click + New to add a row. Set the Date to today. Check the boxes for the habits you completed.
  2. Link each entry to the correct habit
    In the Related Habit column of the Daily Log, click to link the row to the corresponding habit in the Habits database. Each daily log entry should be linked to exactly one habit. If you track multiple habits, add one row per habit per day, or create a separate database view for each habit.
  3. Add entries for past days
    To test the streak, add entries for the last 5-7 days. Check or uncheck boxes to simulate missed days.

Step 5: Write the Streak Formula

  1. Open the Habits database formula
    Click the Streak formula property in the Habits table. Click Edit formula.
  2. Paste the streak formula
    Enter the following formula exactly:
    lets(
      rollupVals, prop("Checkbox Rollup").map(current.prop("Exercise")),
      dates, prop("Checkbox Rollup").map(current.prop("Date")),
      sorted, dates.sort(current.descending()),
      streak, 0,
      sorted.map(
        if(
          rollupVals.at(index) == true and dates.at(index) <= now(),
          streak = streak + 1,
          if(dates.at(index) < now().dateSubtract(1, "days"), streak, streak)
        )
      ),
      streak
    )
    

    Replace Exercise in the formula with the exact name of the checkbox property you are rolling up. The formula assumes the checkbox property name matches the habit name.

  3. Test the formula
    Click Save. The Streak column should display a number for each habit. If you have checked the box for the last 3 consecutive days, the streak shows 3. If you missed yesterday, the streak shows 1 or 0 depending on today's entry.

ADVERTISEMENT

Common Mistakes and Limitations

Streak Does Not Update After Adding a New Daily Log Entry

The rollup property does not refresh automatically when you add a new entry to the Daily Log. To force a refresh, click the Checkbox Rollup header in the Habits database and select Recalculate. Alternatively, reload the page by pressing F5.

Formula Shows an Error or Incorrect Count

The formula uses the checkbox property name as a string. If the checkbox property name in the Daily Log has a different spelling or capitalization than the one in the formula, the rollup will not find it. Open the Daily Log and verify the exact property name. Update the formula to match.

Streak Counts Weekends Even When You Do Not Track Them

The formula checks consecutive calendar days. If you only track habits on weekdays, the streak will break on weekends. To handle this, add a condition in the formula to skip weekends. Or create a separate formula that only looks at weekdays using the formatDate function to check the day of the week.

Database Becomes Slow With Many Daily Log Entries

Notion databases with thousands of rows can slow down rollup calculations. If you track many habits over several months, archive old entries into a separate database. Use a filter in the Daily Log to show only the last 90 days for the rollup.

Notion Habit Tracker: Manual vs Automated Streak Methods

Item Manual Streak Counter Automated Formula Streak
Setup time 5 minutes 20 minutes
Accuracy Prone to human error Calculated from database entries
Update effort You increment the number each day Automatic after each daily log entry
Backtracking Requires manual correction if you miss a day Recalculates automatically when you add past entries
Multiple habits One counter per habit, each updated separately All habits update from the same daily log

The automated formula method eliminates manual counting errors and saves time once the initial setup is complete. The manual method works for a single habit but becomes cumbersome with more than three habits.

You now have a working Notion habit tracker database that calculates streaks automatically. To extend the tracker, add a formula that shows the longest streak or a checkbox that marks a habit as completed for the current day. Use a filtered view in the Daily Log to show only today's entries for quick logging. The formula uses prop, map, sort, and if functions, which you can adapt to track other recurring events like workout reps or reading sessions.

ADVERTISEMENT