Simple Addition and Subtraction
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`
Best Answer
-
@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)
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.2
Answers
-
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.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**3 -
Thank you @GrantSmith . You are wonderful, in all my google searches, this solution did not come up.
Best wishes for a lovely holiday.
0 -
@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)
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.2 -
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.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**3
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 737 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive