Sum values within a date range

I’m looking to create a chart that displays the summed values of user-generated transactions. I imagine I have to pull these values into its own database and then use the values of this summary database as the source for my chart? If so, how can I use the rollup column in conjunction with a date range of a separate database? Thanks for the help!

No, I wouldn’t think that would be necessary.

It mostly depends on the type of chart you want to produce.
I do a lot of charts for my apps, here is how I normally approach the task of adding a new chart:

  • Firstly, I always use quickchart.io. It’s really easy to use once you get the hang of it, and it integrates so well with Glide
  • I always start by figuring out what type of chart I need - bar, line, pie, etc.
  • Then I’ll head over to the sandbox and build the chart out manually, using dummy data.
  • Once I have the chart structure looking the way I want it, then it’s a matter of coercing the data to fit into the chart.
  • For most chart types, that generally means two or more joined list columns will be required - one for each data source.
  • I use two main columns for the chart:
    – A template column, which includes the chart definition - copy/pasted from the sandbox - as well as the data replacements
    – URL column which defines the quickchart URL as well as any additional options
  • And the URL column is used in an Image component

So my advice would be to follow those steps. Do you already know what chart type you need? I’d encourage you to go through the process of building it in the sandbox, as that exercise will help make it clear how your data needs to be structured and presented.

1 Like

The only way I can think of is to create an IF THEN ELSE column in the initial data table (returns the amount If within the date range or zero otherwise) and then roll up a sum of this column
Not efficient but get the results done I hope

2 Likes

Depends what kind of chart you want, but a Glide chart will sum/total values for you automatically…no need for a rollup column.

2 Likes

Thank you! I do know what the chart would look like as I have it in my Google Sheet already. I’ll check out the quickchart.io option and follow your steps. Thanks for laying it out so clearly :smiley:

Good idea! Thank you!

I currently have a summed value in the chart, but I’d like it displayed as totals per each month, broken down by specific items from that total.

For this type of situation, I like to create a working table (Glide Table) with 12 rows - 1 row for each month. You can then get the data for each month on a separate row through a series of templates, relations and rollups. From there, it’s easy to present month by month data in a chart (or a table).

Here’s an example of what I mean:

1 Like

Ok, this is looking like something I’m trying to do. So how are you getting the rollup data for any given month? It’s in a different table, right?

Yes, that’s correct.
If you look at the 4th column in my example (tp/year-month), that’s a template column that concatenates the current year and month name for that row from the 2nd column.
I have a similar template column in the table that contains the source data.
And so the relation (5th column) is created by joining those two template columns. And then the rollups are done through that relation column. The end result is that the numbers shown in the rollup columns are specific for each month.

2 Likes

Another question, so with this data, you’d still use quickchart.io or would you use a Glide chart?

I always use quickchart.io - even if I don’t have to. But that’s partly personal preference and partly because I like to keep a common look/feel to all my charts.

That choice is really up to you. If the Glide chart component gets the job done, then there is really no reason not to use it. But if you’re making lots of charts, it will only be a matter of time before you need something that it won’t do.

1 Like

Awesome! So thinking ahead: how is the next year handled? Do you as the admin just add more months or do you make another table for another year?

hehe, I haven’t decided yet.

But it is something that needs to be dealt with soon. I have several tables like this. With some of them, I probably won’t do anything because we’re only interested in the current year - so they will just roll over on Jan 1. But there might be a couple where a bit of history is needed. For those I’ll probably just add a few rows.

1 Like

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