⚪️

Hi There, I am having trouble in returning correct values with a simple addition and

subtraction beast mode. It appears that any column with a blank value will not return a end value. And any row with values in all columns calculates properly. Any suggestions on how to calculate to consider blank values as zero value? Thanks

Beast mode calculation formula:

End Future Stock Balance:

`Total Stock`+`Total QTY to be delivered`-`Total fcst QTY`-`Total Reqmt QTY`

Tagged:

• Portland, Oregon 🔴

@Emma the IFNULL function is also useful for this and does the same thing. COALESCE is useful when you need to evaluate multiple fields before replacing with a single value. Here is what yours would look like with the IFNULL function:

```IFNULL(`Total Stock`,0)+IFNULL(`Total QTY to be delivered`,0)-IFNULL(`Total fcst QTY`,0)-IFNULL(`Total Reqmt QTY`,0)
```

• Indiana 🥷

Hi @Emma

You can use the COALESCE function to default a null value to a specific value. It does this by selecting the first non-null value in the list of parameters given

```COALESCE(`Total Stock`,0)+COALESCE(`Total QTY to be delivered`,0)-COALESCE(`Total fcst QTY`,0)-COALESCE(`Total Reqmt QTY`,0)
```

If you use simple arithmetic operators (+, -, *, /) with a null the end result is null because it doesn't know how to handle nulls.

• ⚪️

Thank you @GrantSmith . You are wonderful, in all my google searches, this solution did not come up.

Best wishes for a lovely holiday.

• Indiana 🥷

Glad this worked for you @Emma. Can you make sure to accept the answer so it's easier for others to find in the future? Thanks.