# Best approach to show monthly summary in Expense Tracker app

**URL:** <https://community.glideapps.com/t/best-approach-to-show-monthly-summary-in-expense-tracker-app/62486>\
**Category:** Ask for Help\
**Created:** [June 6, 2023, 7:04am UTC](https://community.glideapps.com/t/best-approach-to-show-monthly-summary-in-expense-tracker-app/62486 "2023-06-06T07:04:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![schrutefarms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/schrutefarms/32/59686_2.png) [@schrutefarms](https://community.glideapps.com/u/schrutefarms)\
**Post date:** [June 6, 2023, 7:04am UTC](https://community.glideapps.com/t/best-approach-to-show-monthly-summary-in-expense-tracker-app/62486/1 "2023-06-06T07:04:13Z")

</div>

Hi everyone,

I have recently started playing around with Glide and really appreciate this support forum. I have built a simple app to log our expenses for the month. It currently have only 2 tables - Categories and Expenses. Everything works fine so far, but I would like to add the following features:

- A Component showing the total sum of all expenses for the current month.
- A Chart showing the total amount for the different categories for the current month.

Before I start building this I would like to ask for your opinions of the best approach to this. Also, I have been trying to understand use cases for the new Query column but I don’t really understand it fully yet, is that something that I could use in a case like this? If not, then I am happy to learn about other approaches to this.

---

<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:** [June 6, 2023, 7:41am UTC](https://community.glideapps.com/t/best-approach-to-show-monthly-summary-in-expense-tracker-app/62486/2 "2023-06-06T07:41:18Z")

</div>

> [@schrutefarms](#):
>
> A Component showing the total sum of all expenses for the current month.

My suggestion:

- Create a math column in your Expenses table using the following formula:`Year(Now) * 100 + Month(Now)`

- Use the current date/time (Now) as a replacement value  

- Create an identical math column, but this time use the Expense Date as a replacement for Now.

- Now create an if-then-else column:  
– If first math column equals second math column, then Expense Amount

- Finally, create a rollup column that takes a sum of the if-then-else column

> [@schrutefarms](#):
>
> A Chart showing the total amount for the different categories for the current month.

You can make good use of the Query column for this one. Create the following in your Categories table:

- Start with a Query column. Point it at your Expenses table and add two filters to it:  
– First math column equals second math column (the same two columns as above), AND  
– Expense Category is This Row → Category
- Create a rollup column that takes a sum of the Expense Amount column via the Query column.
- You should now be able to use your Categories tables as the source of a chart.

> [@schrutefarms](#):
>
> Also, I have been trying to understand use cases for the new Query column but I don’t really understand it fully yet

The documentation for this was added a few days ago, and it contains a few example use cases. Maybe that will help?

> **[Query Column | Glide Docs](https://www.glideapps.com/docs/automation/computed-columns/query-column)**
>
> Create complex relations in your data with conditional filtering, sorting, and limits.

---

<div class="post-metadata">

**Author:** ![schrutefarms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/schrutefarms/32/59686_2.png) [@schrutefarms](https://community.glideapps.com/u/schrutefarms)\
**Post date:** [June 6, 2023, 8:07am UTC](https://community.glideapps.com/t/best-approach-to-show-monthly-summary-in-expense-tracker-app/62486/3 "2023-06-06T08:07:46Z")

</div>

Excellent, let me try to build this out right now. Will get back with the result 🙂

---

<div class="post-metadata">

**Author:** ![schrutefarms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/schrutefarms/32/59686_2.png) [@schrutefarms](https://community.glideapps.com/u/schrutefarms)\
**Post date:** [June 6, 2023, 9:26am UTC](https://community.glideapps.com/t/best-approach-to-show-monthly-summary-in-expense-tracker-app/62486/4 "2023-06-06T09:26:01Z")

</div>

This worked great! And I finally understand how to use the Query column, it seems like a relation column with filter options 🙂 I already had a relation to the related expenses so I could set up the Query column through this relation which I assume can speed things up when there are many records. Thanks so much for helping me with this!

---

<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:** [June 6, 2023, 9:33am UTC](https://community.glideapps.com/t/best-approach-to-show-monthly-summary-in-expense-tracker-app/62486/5 "2023-06-06T09:33:07Z")

</div>

> [@schrutefarms](#):
>
> And I finally understand how to use the Query column, it seems like a relation column with filter options

Yeah, kind of. Although you’re not actually matching two columns like you do in a relation. If you’ve ever used SQL, it’s more like that, eg: `SELECT * FROM Table WHERE [CONDITIONS] ORDER BY Foo LIMIT n;`

---

<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:** [June 7, 2023, 9:33am UTC](https://community.glideapps.com/t/best-approach-to-show-monthly-summary-in-expense-tracker-app/62486/6 "2023-06-07T09:33:27Z")

</div>

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