Hey guys ⋆ ˚。⋆୨୧˚
In this tutorial, I’ll guide you through creating a streak counter in Notion! This tracker helps you stay consistent with daily activities, whether it’s language study, revision, or hydration goals. The streak counter will keep you motivated, and I’ll also dive into advanced Notion formulas—perfect if you’re looking to add custom features or take your Notion skills to the next level. Try it out, and let me know how it goes, or if there’s anything else you’d like to see in future videos. Keep watching and let’s get started!
Disclaimer
Note: This blog follows the longer tutorial available on YouTube. There are slight differences in the property names used between the short and long tutorial, so keep that in mind as you follow along!
🫧 10% off on My Glow-up Diary template & custom iphone integration (~ Nov 16th)
Before diving in, I want to introduce you to my latest template: the Glow-Up Diary by NWR! This template is designed to simplify and elevate every aspect of your routines, self-care, and wellness journey. Unlike any templates you’ve seen before. The template itself is crafted it with meticulous attention to detail, making it both functional and aesthetically pleasing but what I want to highlight here is the custom iphone integration. This has been a complete game-changer! With just a tap, you can log your entries directly, seamlessly syncing your actions with the Notion template in real-time. The link to the template is in the description. Currently, you can get 10% off this template for limited time so be sure to check it out!
Search
1. Create a New Page
The video begins at step 1 (1:10)
•
First, create a new page or locate an existing page where you already have a calendar database. For this demo, I am going to start fresh and create a new page.
•
Give the page a name, cover, and icon. I am also going to change the font and set it to full-width by clicking on the ••• at the top of the page.
2. Create a New Calendar Database
The video begins at step 2 (1:30)
•
Next, type / and search for Database Inline, then click it. Click + New Table and name your database. Let’s say we’re tracking our language practice similar to Duolingo, so we’ll name it Language Revision. I’m going to hide the database title for a cleaner look, but this is optional. Also, rename the view and add an icon.
•
Delete all the initial entries in the database. Click the ••• at the top right, choose Layout, and switch the view to Calendar.
•
Go back and if you look at the property, you’ll see a Date property added automatically. We don’t need Tags property so delete that.
3. Create a Streak Counter Database
The video begins at step 3 (2:14)
•
Now, we are going to create a second database. Before that, I’ll create two columns by typing /2 columns. Place the calendar database on the right.
•
On the left, type /database and select Database Inline. Click + New Table and name your database. I’m going to call it Streak Counter, but feel free to name it however you like. For this demo, I’m just hiding the database title and adjusting the width of the left column. Delete the Tags property since we don’t need it here.
•
Also, since we’re only tracking entries from one calendar database, delete two entries from the database, leaving only one. Name the remaining entry. Let’s call it Language Streaks.
4. Setting Up Relation Property
The video begins at step 4 (3:03)
•
In the Streak Counter database, create a relation property by clicking on the plus sign. We are going to create a relation property that links to the Language Revision database. We’ll make it a two-way relation, then click Add Relation. You will see a relation property in the Language Revision database. Let’s change the name to Counter.
•
We want all the entries in Language Revision database to be accumulated and counted towards this tracker. So if you already have entries on the Language Revision database, on Relation property Streak Counter, link a page or entry, language streaks.
•
Then, for future entries to be linked to the page Language Streak, set up the filter in the Language Revision database such that every time you create a new entry in this database, it counts relevant entries towards the streak counter.
5-1. Create a Streak Formula - The Idea
The video begins at step 5-1 The idea (3:54)
•
Now comes the fun part, in the Streak Counter database, create a formula property and name it streak. Now open up the Formula.
The concept is straightforward: we calculate the differences between consecutive dates and identify where the gap exceeds one day, signaling a break in the streak. If such a break is found, we extract the latest date before the gap and count how many entries follow it to determine the streak length. If no break is detected, meaning the streak is unbroken, we simply return the total number of entries as the streak length.
•
Doing this in Notion requires the following process.
◦
First, we will retrieve a list of entry dates from the Language Revision database and store this in a variable named listOfDates.
◦
Next, we will create a new list of dates based on the entry dates from the Language Revision database, but this time, we will “push” the dates. For example, if you have a list of dates like [Oct 17, 18, 20, 21, 23], we will first shift the dates to the left, resulting in [18, 20, 21, 23]. Then, we will modify this list by adding today’s date (let’s say today is the 24th), giving us the final list of [18, 20, 21, 23, 24]. We will store this in a variable named listOfDatesPushed.
◦
Now, we can subtract each element in listOfDatesPushed from listOfDates and look for differences greater than 1. Finally, we’ll find the most recent date from listOfDatesPushed that meets this criterion and store this into a variable, breakOff.
◦
Finally, we are left with two cases: 1) breakOff is empty, which means the streak has not been broken, and 2) breakOff is not empty, indicating that the streak has been interrupted at some point.
◦
In the first case, we can simply count the number of entries in listOfDates to determine the length of the streak. In the second case, we can retrieve the entries that are greater than or equal to the breakOff date from listOfDates, then count those entries to find the length of the streak.
5-1. Create a Streak Formula - Implementation
The video begins at step 5-2 The implementation (5:54)
Here is the final formula! Feel free to open up the toggle to see the breakdown
lets(
listOfDates, prop("language revision").map(current.prop("Date")).sort(),
listOfDatesPushed, prop("language revision").map(current.prop("Date")).sort().slice(1).concat([today()]),
breakOff, listOfDatesPushed.filter(current.dateBetween(listOfDates.at(index), "days") > 1).sort().last(),
"🔥" +
if(breakOff.empty(), listOfDates.length(), listOfDates.filter(current >= breakOff).length())
)
Notion Formula
복사
Breakdown of the Formula
6. Formatting the Streak Counter database
The video begins at step 6 (12:34)
•
Now, we are switching this to Gallery view. Click on ••• in the corner of the database > Layouts > Gallery. I’ve set the Card Preview to None and the Card Size to Small.
•
Next, go back and click on Properties, then only show the Streak (the Formula property). This way, only the streak counter will be displayed for a clean final layout.
7. [Additional] Add the button
The video begins at step 7 (13:03)
•
We can also create a button that will automatically add an entry to the database. To do this, type /button. Click + Add Action. Choose Add Page To and select your Language Revision Database (or whatever you named your calendar database).
•
Next, find the Date property, select it, and choose Date Triggered.
•
Then select counter and link language streak.
•
Name the button and name the entry in Name, the title property.
8. [Additional] Show date when streak last started
The video begins at step 8 (13:54)
lets(
listOfDates, prop("language revision").map(current.prop("Date")).sort(),
listOfDatesPushed, prop("language revision").map(current.prop("Date")).sort().slice(1).concat([today()]),
breakOff, listOfDatesPushed.filter(current.dateBetween(listOfDates.at(index), "days") > 1).sort().last(),
"🔥" +
if(breakOff.empty(), listOfDates.length(), listOfDates.filter(current >= breakOff).length())
+ "\nstart:" +
if(breakOff.empty(), listOfDates.first(), breakOff)
)
Notion Formula
복사
•
Similar to the if statement we used to calculate streaks, we can also display the date the streak started.
•
To do this, in the streak formula, at the very end of the expression, type + "\nstart:" + We’ll then join it with a new expression that returns a date. If the breakOff field is empty, the formula will return the earliest date in the listOfDates; otherwise, it will return the breakOff date.
9. [Additional] Tracking multiple streaks
The video begins at step 9 (14:42)
•
You can add extra counters to the streak counter database to manage multiple streaks.
•
First, create a new entry in the streak counter database for your new streak. Name it depending on what it is for.
•
Duplicate the view in the calendar database (Language Revision) and rename it to reflect the new streak you’re tracking. Throughout the tutorial, we assume that we are only tracking the streak for language revision, so feel free to change the name of the database to suit your needs.
•
Update the filter. Unlink the entry currently connected to counter, and link it to the new entry we create. That’s it! Now, each time you add a new entry, it will automatically update the correct streak counter.
•
Optional: You can also create a button to streamline this process. Simply duplicate the button from step 7, rename it, edit the Name and Title properties, and update the counter relation property to ensure the new streak counter entry is linked.
Conclusion
Thank you for reading this tutorial! If you found it helpful, be sure to check out shop for my beautiful templates, which I am confident enough to say are a game-changer Subscribe to my newsletter and feel free to follow me on my social media for updates!
Happy Notion(ing)!
links
Search