Grouping totals based on dates

Hi all,
Apologies for starting a new thread on this subject as I’ve seen it covered already in a few other posts but I’m still stuck!
I have a very simple app that contains a list of expenses and I would like to group these expenses by day, week & month and so far I have setup the following…



I’ve split the entry dates into day/week/month using the formulae suggested in other posts and these have worked well and I can make relationship fields with nowDay/Week/Month. The last bit I’m struggling with is how to get the rolled up total for each period in the thisMonthTotal column.
Eventually I want to normalise the grouped totals into a different table rather than lumping on repeated columns all in one table but that comes later!
thanks for your help in advance.
Rob

I see two issues:

  • Firstly, you are targeting a table directly with your rollup, which means that every row in the table will be used in the rollup. What you should be doing is targeting via a multiple relation.
  • Secondly, your rollup is targeting an if-then-else column which doesn’t allow you to sum the values. It’s not clear to me what the purpose of the if-then-else column is, but I would expect you should be targeting an amount (number type) column.

OK re your 2nd point I had a mistake that you can ignore that.

For your 1st point, I don’t see the relationship columns in the field selector.


This is how I’ve defined the thisMonth relationshp column…

thanks for your prompt reply btw!

Your relation needs to be a multiple relation, see below:

Once you fix that, you should see it as an option at the top of the list in the rollup configuration.

ah yes getting there! However the rolled up total is still showing the amount of all rows.
For this month I would expect to see 363 not 1723.

Yes, I see that. As far as I can see, everything looks correct.
Does the rollup value change once you save it?

Sorry I’m away from my PC for the rest of the day but I’ll look into it this evening.
I was getting the same 1723 amount in weekly and monthly columns. Daily was correctly showing 0.

On another note, what are your thoughts on storing the grouped totals in a separate table?

I often do this. It’s especially useful if you want to show data for multiple periods. For example, 12 months. What you would do is have one row for each month of the year, and then build similar relations and rollups, then present the data in a table collection.

I changed the value of the amount in one of the rows and the rolled up value has updated to 1728 but again it has rolled up all the rows not just the ones caught in the relationship.

yeah I’ll try that next. Have a table for weekly and another for monthly and have a row in the respective tables for each week or month. Would still like to sort out the issue I have when using 1 table though as it’s a learning experience!

I think I see the problem, it looks like your relation is the wrong way around.
You should be matching “nowMonth” to “entryMonth”.

Try switching that around.

Ah I don’t quite understand relationships well though so I’ll have a further read about them.
It looks a lot better now and totals look good but I have an entry in every row regardless of whether that row was in the current month or not. Is that expected?

Yes, that’s fine.
It’s because you’re matching from the current week/year/month (which is correct), and those columns have the same value in every row. So every row is finding matches.

1 Like

Many thanks for your help!

I’ll be back when I try splitting the tables :slight_smile:

1 Like

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