Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Excluding Zero values from an Average Rollup

Topic Labels: Formulas
Solved
Jump to Solution
3590 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Mac
8 - Airtable Astronomer
8 - Airtable Astronomer

Is it possible to exclude records that have a zero value from an average rollup?

1 Solution

Accepted Solutions
drassi
6 - Interface Innovator
6 - Interface Innovator

There is no built-in aggregation function that does this. The easiest way I can think of to do this is simply create a formula column on the child table that filters out zeros, then do an AVERAGE() rollup on the formula field instead of directly on the numeric field. E.g.:

New “Nonzero” formula column on child table, with formula “IF(Value>0,Value)”
Rollup column on parent table, redefined as Rollup > Child Table > “Nonzero” > AVERAGE(values)

Should do what you want.

See Solution in Thread

2 Replies 2
drassi
6 - Interface Innovator
6 - Interface Innovator

There is no built-in aggregation function that does this. The easiest way I can think of to do this is simply create a formula column on the child table that filters out zeros, then do an AVERAGE() rollup on the formula field instead of directly on the numeric field. E.g.:

New “Nonzero” formula column on child table, with formula “IF(Value>0,Value)”
Rollup column on parent table, redefined as Rollup > Child Table > “Nonzero” > AVERAGE(values)

Should do what you want.

Johannes_Strobe
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi @drassi ,

thanks, this helped me to solve my issue. However, there is no example, so I didn't figure it out the first time.

My solution was to return BLANK() instead of a 0, when the Formula encountered a BLANK() at the first or second value. If this is done, the AVERAGE() function of the Rollup skips these values.

Example:
  • Values is the first table:
    • Data: The data are either blanks or numbers from 1 to infinite. They represent "bad" and "good" occurrences. 
    • Formula: IF(AND({👍}=BLANK(), {👎}=BLANK()), BLANK(), IF({👍}=BLANK(),-{👎},IF({👎}=BLANK(),{👍},{👍}/({👎}+{👍}))))
  • Rollup in the other table: IF(COUNTA(values)!=0, AVERAGE(values), BLANK())

Hope it helps other people!

 

Best regards
Johannes