Sum values by month

Hi, I need to sum the values by month in order to create a dashboard of expenses. My first approach is to create a table with all the expenses and then do some calculations to display the data in the layout of the app.

Ideas:

  • Create a separate table with the time items along which you want to do rollups (sum, averages, count). Eg. Jan, Feb, … , Dec

  • Try the Query column

1 Like

Can you provide an example? That table wouldnt affect too much the number of files in my app?

You need to transform the date to yyyyMM format (math column: year*100+month). Then you create a column with unique values from that yyyyMM column… then relate that Unique column to formatted date column… and sum that relations

I think it’s important to plan what one will want to see in the layout. Is it a collection or chart per calendar year, is it a collection or chart of the last n months rolling?

If the time frame is static (months, quarters or years for instance, non-rolling), then I like the idea of creating a separate table with the unique values that you would want to see on the x axis (for instance Uzo’s yyyyMM, which would be months of year yyyy).

A relation is fine. But I do think a Query column here would also work fine, it’s more intuitive and versatile than a Relation column.

2 Likes

The app is intended to be an expense tracker. I just want to log expenses by date and thought of having just one table with all of them. Then in the layout Id like to see what have I spent for a particular month or category. It should be as simple as that. Im new to glide and trying to keep up with the feedback but Im not familiar with what you have advised.

1 Like