Hello everyone,

I have recently started playing around with Glide and really appreciate this support forum. I have built a simple app to log in our monthly expenses. It currently has only 5 columns - Description, Category, Expense Type(Fix/Variable), Date and Amount Spent. 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.

Before I start building this I would like to ask for your opinions of the best approach to this. Thank you!

A simple way to do this is to create two math columns - one that represents the current month and another that represents the expense date month - then relate the two together, and then do a rollup through the relation to get a sum.

For the math columns, use the following formula:

```
Year(Date)*10^2
+Month(Date)
```

Replace â€śDateâ€ť with the special current date/time value in the first math column, and replace it with the expense date in the second math column.

When you create the relation, you want to match the first math column with the second math column, and you should ensure it is a multiple relation.

And finally add the rollup and target it at the relation column, and select Sum->Expense Amount.

1 Like

Hey Darrem,

Firstly thank you so much for your quick reply.

I am a beginner, so please bear with me. Here is the screenshot of all the columns including the two new columns you asked me to create. The values I see are a bit weird.

I have also attached screenshots of the properties of each of these new columns.

Could you please help me understand what is wrong here?

Plus, I do not know how to relate these two columns, could you elaborate a bit more?

Thank you so much again.

What you have there is fine, I would just set the precision to 1, and uncheck the â€śUse group separatorâ€ť box. That should result in something that looks like `202404`

(year 2024, month 4). It will still work the way you have it, but getting rid of the comma and extra precision makes it a bit more readable.

The relation is pretty straight forward, have a read and watch below:

The important thing is to match the first math column (current month) with the second math column (expense date month), and be sure to check the â€śmatch multipleâ€ť box.

If you get stuck, share some more screenshots.

2 Likes

oh sorry, I just looked again and realised your math column for Current Month is wrong. You should be replacing Date with â€śNowâ€ť - see below:

1 Like

Thank you again, here is the outcome of what you just asked me to do.

a

Now, how can I display the total amount spend in the current month?

Here is what I tried - the component at the bottom reads 650/202405. This does not feel right, I have spent around 8000 but it shows 650.

You missed the final step:

True but this is what I get, 24. Something seems off.

Change your â€śAmount Spentâ€ť column to number, then use the â€śsumâ€ť option in the rollup.

2 Likes

It works perfectly, thank you so much for the help @ThinhDinh and @Darren_Murphy

2 Likes