Hi,

Is there a way in Glide to create a cumulative sum of the rows in a column, like adding up monthly sales ?

- Jan
- Jan+Feb
- Jan+Feb+Mars
- Jan+Feb+Mars+Apr

etc…

Thanks!

Hi,

Is there a way in Glide to create a cumulative sum of the rows in a column, like adding up monthly sales ?

- Jan
- Jan+Feb
- Jan+Feb+Mars
- Jan+Feb+Mars+Apr

etc…

Thanks!

Take a look at this…

6 Likes

Hola,

We solved a similar case time ago, here you can see it to complement the Darren’s idea:

Saludos!

If you need any help with how this would look like in practice feel free to check out this template here. It was developed to incorporate running totals that you can copy. Fun Step Tracker Template • Glide

1 Like

Since I’m looking for monthly cumulative sums in a year, I have a finite number of rows (12).

So I decided to do in just in Glide by creating a single value column for each month and multiply it by 12 columns containing 0 or 1. A Math column then gets me the desired cumulative sum.

Can you explain more about this part?

Yes, I’m also curious. Would love to learn a simpler approach.

1 Like

Ok, so I start with a Rollup Sum giving me the Revenue for each month.

I then create 12 Single Value Columns each containing the Revenue for any given month across every row (using the month-1 as index from start).

Then I create 12 columns with zeroes or ones. ex Jan is 12 ones, Feb is zero followed by 11 ones, and so forth…

And the cumulative column is created by a math column that sums the multiplication of each month’s revenue column by that month’s zeroes & ones column.

The static zeroes & ones columns act like an if then else in the Math column through multiplication (if zero don’t add that month)…

Obviously doesn’t work for infinite rows, but works very well, within Glide, for Yearly cumulative charts…

Quick example for 5 months…

BTW it would be nifty if one could index a row number in a math column (ie MonthlyRev[2] for March Rev). That would negate the need for the 12 Single Value Columns…

oh, I see… very brute force approach

Did you actually look at the solution that I offered? It only requires 6 columns in total.

It probably looks like there are lots of columns in the video, but most of those are used for other things.

5 Likes

Actually I was answering another thread (in the wrong place) that used javascript (which I wanted to avoid), and totally missed yours. It’s very cool!

1 Like

Actually, can’t you remove the last step by making your Relation look like this, starting at row 0 instead of row 1 ?

1 Like

Yep.

The only reason I had it the way it was is because the client needed both start of month and end of month values.

But yes, you’re absolutely correct

3 Likes

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

Hey guys, I know this topic is already close, and @Darren_Murphy saved us up, but I wanted to bring another insight of how to do it with a few columns, once Glide also improved a lot in the past 1y.

Take a look:

2 Likes

Yes, query column makes so much easier

1 Like