Using Sum Function to add columns

I have three columns in the same table that store three separate numeric values.

Column One is called- “John”
Column Two is called- “Bill”
Column Three is called- “Ed”

I would like to add a fourth column that adds (for each row) the values contained in “John”, “Bill” and “Ed”

I am using this formula for the fourth column-
sum(field(‘John’)+field(‘Bill’)+field(‘Ed’))

The fourth column isn’t displaying data consistently. What am I doing wrong?

sum is intended for use when you are adding up a lookup or link field. If your three columns are just normal number columns then you should simple write:

field(‘John’)+field(‘Bill’)+field(‘Ed’)

1 Like

Nigel- Thanks for the response. I set the value of column four (Total) to be-
field(‘John’)+field(‘Bill’)+field(‘Ed’)

The formula is accepted but nothing is showing up in Total even though there are numeric values in John, Bill and Ed.

Thinking that Total was simply not calculating for preexisting values, I entered new data into John, Bill and Ed and Total will not update. Any ideas?

FYI- Figured it out. John, Bill, and Ed have to have a value (I used zero). They can’t be empty.

Ah, that is rather surprising I agree. I’ve made this issue to make numeric operators treat empty as 0 as I think that is much more sensible. This is an unintended consequence of the way the database Baserow uses treats empty values, any empty value + any other numeric value will always equal empty.

For now you could also use the when_empty function like this:

when_empty(field(‘John’), 0)+when_empty(field(‘Bill’), 0)+when_empty(field(‘Ed’),0)
1 Like