DB Folder: count sum of the specified rows

Hi guys, I am not an expert in DB Folder formulas, so I hope you can help me with the following (conceptually) not very difficult task. I have the table with the courses:


At the moment you can see that the standard “sum” function counts credits for all the courses given. However, I want some formula in the bottom field, that also counts the sum, but only of the courses with the property “status” being either “done” or “approved”. Any ideas? Thank you!

1 Like

I need the same. If a filter is applied in DB folder, the sum is still showing the total sum for all the items in thje database, and not the filtered ones. I’m using database for my personal finances, and I need it to show the sum of what I have to pay this month, this week, or for certain category. Did you find any workaround?

You need to combine a row formula with a column formula.

  • add an extra column to your table, and use a row formula to only present a value if matching your criteria, and 0 if not matching
  • in the footer sum (or count) the values in that extra column

Here is my simple test table:

It has two formulas:

  • Row formula for “Approved credits”: ${ ( row.status == 'approved' || row.status == 'done') ? row.credits : 0 }
  • Footer formula same column: ${ values.reduce((a, c) => a + parseInt(c), 0) }

Couldn’t find that “sum” formula, so I made my own… :slight_smile:

The same trick of validating or filtering before a potential count operation can be done the same way.

out of the blue question… can you help me write an average formula in the footer?

I’ve looked around everywhere and couldn’t find anything pointing in this direction.

Thank you @holroy :pray: