# Sum values within a date range

**URL:** <https://community.glideapps.com/t/sum-values-within-a-date-range/34186>\
**Category:** Ask for Help\
**Created:** [November 8, 2021, 2:08am UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186 "2021-11-08T02:08:46Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 8, 2021, 2:08am UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/1 "2021-11-08T02:08:46Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [November 8, 2021, 2:33am UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/2 "2021-11-08T02:33:43Z")

</div>

> [@Trading\_5\_Talents](#):
>
> 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?

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

> [@Trading\_5\_Talents](#):
>
> If so, how can I use the rollup column in conjunction with a date range of a separate database?

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](http://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](https://quickchart.io/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.

---

<div class="post-metadata">

**Author:** ![ybastami](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ybastami/32/8114_2.png) [@ybastami](https://community.glideapps.com/u/ybastami)\
**Post date:** [November 8, 2021, 3:02am UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/3 "2021-11-08T03:02:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [November 8, 2021, 3:32am UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/4 "2021-11-08T03:32:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 8, 2021, 1:10pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/5 "2021-11-08T13:10:43Z")

</div>

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](http://quickchart.io) option and follow your steps. Thanks for laying it out so clearly 😃

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 8, 2021, 1:11pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/6 "2021-11-08T13:11:13Z")

</div>

Good idea! Thank you!

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 8, 2021, 1:12pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/7 "2021-11-08T13:12:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [November 8, 2021, 1:19pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/8 "2021-11-08T13:19:27Z")

</div>

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:

 ![Screen Shot 2021-11-08 at 9.18.40 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/f/2/f298ce91ea43caa19014754d468edbe0c2318ca9.jpeg)

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 8, 2021, 1:28pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/9 "2021-11-08T13:28:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [November 8, 2021, 1:32pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/10 "2021-11-08T13:32:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 8, 2021, 1:33pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/11 "2021-11-08T13:33:20Z")

</div>

Another question, so with this data, you’d still use [quickchart.io](http://quickchart.io) or would you use a Glide chart?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [November 8, 2021, 1:36pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/12 "2021-11-08T13:36:09Z")

</div>

I always use [quickchart.io](http://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.

---

<div class="post-metadata">

**Author:** ![Trading\_5\_Talents](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/trading_5_talents/32/33858_2.png) [@Trading\_5\_Talents](https://community.glideapps.com/u/Trading_5_Talents)\
**Post date:** [November 8, 2021, 1:38pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/13 "2021-11-08T13:38:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [November 8, 2021, 1:42pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/14 "2021-11-08T13:42:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [November 9, 2021, 1:43pm UTC](https://community.glideapps.com/t/sum-values-within-a-date-range/34186/15 "2021-11-09T13:43:15Z")

</div>

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