Notion: Averaging Multiple Rows From a Database and Putting The Result Into Another

Objective:

  1. Gather all totals in a database under the property called “Days”
  2. Get the average of all the rows.
  3. Put that number into another database.

Here is what has worked so far:

In another scenario here, this is the setup.

This top one works great.

But this bottom one here that I am trying to average? Will not return anything but 0.

I’ve triple checked the property name and the filters. Nothing. I don’t get it lol.

Any help would be greatly appreciated!

Hi Bryson,

I would check:

  1. What’s the output of the map function (without the average) - so you can find out if the Days numbers are being passed correctly

  2. What property type is “Days” in Notion? If it is not a Number, the mapping may be off

Hey Simo!

2. It’s a formula property returning a number.

Am I missing something?

Yes you see how “number” is nested within “Days” (collection) in screenshot 1; so your map function must reflect that. Currently you only map until until the collection, which likely returns empty/null.

Something like this might work:

average(get(map(map(array;properties_value);Days);number))

1 Like

I see what you’re saying. I tried this, and a couple other slight iterations of this, and still returns empty. Tricky tricky.

I changed everything from a formula property to a normal numbers property. THAT worked, but not what I need. I also noticed if just 1 row is empty, the average doesn’t work. All rows must contain something. Also not what I need.

For context, the formula number is the property “Days” which refers to the amount of days someone has been in the program. I want to get averages of everyone once per month and return a number in another database with a whole bunch of other metrics. “Days” has to be a formula as the entire point of this is automation, obviously.

I appreciate your help so far!

After messing around with this for hours, and after your help, I finally got a working solution. Oh the finickiness of these formulas lol.

3 Likes