How to create running totals

I need to chart a running total of a dataset. The only way I found how to make running totals is using a repeating group and summing up to current cell. But there is no way to chart this unless I somehow save the repeating group cells into a list.

Can someone help me figure out a way to chart running totals of a dataset?

Let’s take an absurd example of calculating the cumulative age of users. So, our RG will be:

Adam - 20 - 20
Ben - 25 - 45
Charlie - 23 - 79

  • Have a repeating group with your data (let’s call it Repeating Group Users)
  • Have a hidden repeating group in a popup somewhere which is a list of numbers (Repeating Group User's:each item's age). Let’s call this var (variable) - list of ages
  • Within each cell of the repeating group, to display the cumulative age, do var - list of ages:items until Current cell's index:each item's sum. So, in cell 2, it will dispay the sum of 20 and 25. In cell 3, it’ll display 20 + 25 + 23.

Now, to apply that to a chart, you have to do some funky logic. The problem is to put in a chart, you need a list of numbers. So, how do we go from a list of data types to a list of numbers that we can pass into a chart? It’s best to see my demo here:

Editor
Demo

  • get list of data types
  • format as text
  • work out the current data types index / item #
  • sum all of the values up until current data’s item #
  • format that as text and split by comma
  • list of cumulative sum numbers :slight_smile:

1 Like

Thank you.

I am following what you did but not sure how you put these paratheses after “items until #”

Screenshot 2023-11-27 at 10.09.11 AM

Go to versions in the app settings and enable the parentheses / expression composer

1 Like

It worked and taught me alot! Thanks.
Great to see they finally got paratheses. Life sucks without paratheses…

Question:

What are you extracting with regex and why?
I figure this is just a index counter but not sure why we cant just do without the extract. Sorry but I am an obvious newb…

This topic was automatically closed after 70 days. New replies are no longer allowed.