javascriptnotion

How to calculate Current Monthly Attendance?


Using Notion, I have databases one Class Lessons and one for Summary Stats.

In the Class database, I have a Relation type property linked to Summary Stats for every class.

In the Summary database, I have a rollup to count the all-time overall total number of class lessons done and dates etc.

However, I would like another property setup in Summary Stats to calculate and show Current Monthly Attendance (count how many lessons have been attended this current month) in number format.

Overall, I am struggling to create a formula to count out how many lessons are in the current month because filter is not a function in Notion.

How can I achieve a property to count Current Month only in order to view class count for the current month?

Thanks


Solution

  • I've found a simple solution.

    I created a new property in the Class database with a formula to check if the date is in the Current Month.

    formatDate(prop("Date"), "MM/YYYY") == formatDate(now(), "MM/YYYY")
    

    Then in the Stats Summary, I used a Rollup to Count the Checked boxes. This presents me the Dates in the Current Month as required.

    The limitation here though is that there is no condition with upcoming classes in the Class database after 'Today'. But for my requirements that's okay, because the Class only gets added and recorded after it happens.