getting the moving average in coda.io

Moving average in Coda

Comparing dates and using filters

Christiaan Huizer
3 min readDec 10, 2023

--

In my blog about preceding values I argued why in Coda we do not have the concept of previous row, but we work with preceding values. That is the concept we apply as well in the presented solution.

It all has to do with the concepts of rows and how they are related in a table. There is always a sorting active, even when you did not sort the table actively. We call this the initial sorting and more about it in this blog.

Building blocks in a moving average

We need dates and numeric values we can manipulate to get the average. As you know, dates are numbers as well and this makes the application of a filter the easiest choice.

Below we applied a filter to compare dates and in the display column you see how many dates and related numbers we count. We start with one and each row adds one number.

getting all the numbers

The second step is to get only the last 6 numbers and so we slice the the range using Slice(-6)

´sliced results

Last but not least, we take the average and that is it.

getting the moving average over 6 days

My name is Christiaan and blog about Coda. Since the summer of 2023 mainly about how to Coda with AI to support organisations dealing with texts and templates. The latest Coda AI update was on Dec 7, 2023.

Why I focus on Coda AI you can read here: ⤵️

I hope you enjoyed this article. If you have questions feel free to reach out. Though this article is for free, my work (including advice) won’t be, but there is always room for a chat to see what can be done. You find my (for free) contributions to the Coda Community and on Twitter.

Coda comes with a set of building blocks ー like pages for infinite depth, tables that talk to each other, and buttons that take action inside or outside your doc ーso anyone can make a doc as powerful as an app (source).

Not to forget: the Coda Community provides great insights for free once you add a sample doc.

--

--

Christiaan Huizer
Christiaan Huizer

Written by Christiaan Huizer

I write about how to Coda . You find blogs for beginners and experienced makers. I publish about 1 / week. Welcome!

No responses yet