Summarize by groups and only display the sums

Hi @MLAB :blush: !

Correct :blush: !

I used the currently disabled canvas button just above the [View of Summary per Month & Category] :innocent: .

Its action formula is this one:

dbYearMonths.ForEach(
  CurrentValue.WithName(YM,
    dbCategories.ForEach(
      [Summary per Month & Category].AddRow(
        [Summary per Month & Category].dbYearMonths,
        YM,
        [Summary per Month & Category].dbCategories,
        CurrentValue
      )
    )
  )
)

The button first takes the “list of rows” dbYearMonths is (each specific row in the list is represented by CurrentValue) and to each row I give the name YM using WithName() so it can be used later on.

Then, it takes the other “list of rows” dbCategories is (where each specific row is also represented by CurrentValue) and for each row, I ask the button to add a row to the table [Summary per Month & Category] where:

  • for the field [Summary per Month & Category].dbYearMonths it should input YM (the current month in the list)
  • for the field [Summary per Month & Category].dbCategories it should input CurrentValue (the current category in the list)

Sorry if everything’s not clear :pensive: … loops are not the most easiest thing to explain :sweat_smile:
But the button loop through all the months in dbYearMonths, one by one, and for each month it adds each category from dbCategories :innocent: .

Just in case, here’s a topic that helped me a lot when I was struggling with ForEach() / FormulaMap() :blush:

As for this :

I could make some suggestions regarding the consistency, but it depends on your current setup, how you would like/need to add months & categories to their respective tables and also, how you like to interact with your bankstatements table :blush:

There are often more than one way to accomplish anything in Coda :smile:

1 Like