Division by Zero ETL error
Hello
Can someone help me with this error... I am inputting a formula in Magic ETL and am receiving a division by zero error. How can I rectify it? I know in some cases the divisor in my calculation will be 0 but that is fine. An example of the 2 formulas I've tried below. Thanks for any insight.
IFNULL(`Total Stock`=0,0,`Total Stock`/`Conservative Max Qty per plt`)
CASE WHEN`Total Stock`=0
THEN null
ELSE (`Total Stock`/`Conservative Max Qty per plt`)
END
Best Answer

Hi @Emma
You need to check for your denominator to be zero, not your numerator. Try this (will return 0 if `Conservative Max Qty per plt` is 0)
CASE WHEN `Conservative Max Qty per plt` = 0 THEN 0 ELSE `Total Stock`/`Conservative Max Qty per plt` END
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2
Answers

Hi @Emma
You need to check for your denominator to be zero, not your numerator. Try this (will return 0 if `Conservative Max Qty per plt` is 0)
CASE WHEN `Conservative Max Qty per plt` = 0 THEN 0 ELSE `Total Stock`/`Conservative Max Qty per plt` END
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**2 
oh Goodness, thank you for the advice @GrantSmith
0
Categories
 All Categories
 1.5K Product Ideas
 1.5K Ideas Exchange
 1.4K Connect
 1.1K Connectors
 285 Workbench
 4 Cloud Amplifier
 5 Federated
 2.7K Transform
 91 SQL DataFlows
 576 Datasets
 2.1K Magic ETL
 3.5K Visualize
 2.4K Charting
 619 Beast Mode
 25 App Studio
 33 Variables
 609 Automate
 155 Apps
 421 APIs & Domo Developer
 31 Workflows
 2 DomoAI
 29 Predict
 12 Jupyter Workspaces
 17 R & Python Tiles
 372 Distribute
 103 Domo Everywhere
 266 Scheduled Reports
 3 Software Integrations
 100 Manage
 97 Governance & Security
 4 Domo University
 15 Product Releases
 Community Forums
 37 Getting Started
 28 Community Member Introductions
 91 Community Announcements
 4.8K Archive