Photo by Sean Stratton on Unsplash | How to Coda a Rolling Total?

How to Coda a Rolling Total?

Using FormulaMap() and Sequence() to get the job done

About a year ago I wrote a blog about how to deal with a Previous Row logic. In this blog I present a different approach to tackle the same issue. Last year I assumed that Coda would solve the issue programmatically, but I am no longer convinced that this challenge is on their to-do list.

In the mentioned article I use Slice() to get the job done in combination with the Row Index formula : thisTable.Find(thisRow) to generate an ascending number for each row.

thisTable.Delta.slice(1,thisRow.RowIndex).Sum()

Although that works fine, the mentioned solution with FormulaMap() has its benefits and merits of its own.

This morning I had to create a total for each month including previous months.

Rolling Total

One of the benefits is getting acquainted with a logic that is applicable in various settings. Below is the solution I deployed in my blog a year ago to find the delta between two rows.

Delta between two successive rows

The above can be written a bit shorter using WithName() and then you get:

The same using WithName

However we can also use FormulaMap() and Sequence(). We apply the logic and below you see a slightly longer formula.

The step 01 column contains the output without the function Last() It shows all the items and as you see below it outputs the same results as the earlier used function.

The main reason that I would advice to go with the FormulaMap() based solution is that it permits for more flexibility. Maybe you want to skip numbers or you want something else a bit of the normal. In that case the Sequence() function helps you out.

skipping by 2
starting at 0 and skipping by 2

I hope these examples inspire you to make use of the proposed suggestion and to explore the many creative paths opening up for you.

Photo by Ashim D’Silva on Unsplash | Interest Rates in Coda

Interest Rates

Last but not least, do not use the method of previous rows to calculate interest rates. It suffices to apply the Power() function. I wrote in this blog about interest rates.

Coda is a great tool to set up and maintain complex calculations. You avoid getting lost by looking for the right function in the rich Coda toolbox.

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. Besides you find my (for free) contributions to the Coda Community and on Twitter

My name is Christiaan Huizer and I am the owner of Huizer Automation. A company specialized in serving SME in harvesting data and keeping it aligned. I am a Coda Consultant & Expert and rely mainly on Coda, Mailjet, Zapier & Paperform to get the job done.

Huizer Automation — Coda Expert and Consultant on “How to Coda a Rolling Total?”

--

--

--

Christiaan uses Coda mainly for planning & calculations of all sorts. Follow me to learn how to Coda with numbers. I blog at least once per week.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

RBHC — Recursive Binary Hierarchical Clustering

RBHC logo

Implement a simple Operating System

Testing: Mock and Stubs

Technology Radar — May 2020 review — Part 1

How to learn Programming!

Week in Review: The PMP Change Is Less Than 90 Days

How Rakuten Viki Built its Google Play Instant App Back in 2016

Python break, continue, pass statements with Examples

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Christiaan Huizer

Christiaan Huizer

Christiaan uses Coda mainly for planning & calculations of all sorts. Follow me to learn how to Coda with numbers. I blog at least once per week.

More from Medium

How to skip over blanks in Coda?

Old doc, new year: Part III

How To Coda your stock?

How To Coda a Check Box?