How to Get a Sum of Values Only for the Current Month We're In

I’m trying to write a formula that will sum the values in rows that have a date (in the “Period” column) that matches the current month we’re in.

Screenshot 2023-12-23 at 8.55.25 PM
Screenshot 2023-12-23 at 8.55.14 PM

For example, we’re in December right now, so I want the formula to sum 131, 113, and 118. But as soon as we roll into January, I don’t want it to count those. Instead, I want it to automatically count the values with “Jan” in the “Period” column.

hi @Rai_Cornell

good to see you actively working on gaining a better understanding of how to Coda

You need something like below, it s a filter. Filters are the most used function in Coda, understanding how they work and how powerful they are, will help you a lot.

thisTable.Filter(period.Month().Contains(thisRow.period.Month())).OrganicBlogTraffic.Sum()

Your mind tells you, if this then that, while the complete mental phrase maybe should be, if the month of the period contains the month here (or on this row), then take the sum of organic

I hope it helps, Cheers, Christiaan

Hey Christiaan :slight_smile: Thank you!

So the challenge here is that I’m not trying to pull the data into another table. I’m trying to create an at-a-glance reporting widget. See here:

okay, the key phrase is ‘we are currently in on any given account’

in this scenario we work with Today().Month() and the same for year because next year december you want next year december and not this year and next year.

below how that looks:

enjoy your evening!

1 Like

AAAAAHHHH! That’s what I needed! The “today().Month()” and “Today().Year()”!! Brilliant!! Thank you soooooo much, Christiaan!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.