I have created a report that shows Sales, Quantity and Margin.
Margin is created by Sales / Qty. I have totals at a couple of groupings, so Margin is the Total(Sales) / Total(Qty).
In each Margin calculation I have used an if then statement.
If Total(Qty <> 0) then Total(Sales) / Total(Qty) else (0)
This works for for a few companies (there is a prompt and filter on comapny) but there are a number it doesn't work for. I get the error;
Error Number - 51
DMS-E-MATHEXCEPTION, An arithmetic exception was detected.
EXPENG-E-ZERO_DIVR, <Floating point> divide/mod by zero is invalid.
I'm querying against a SQL Server 2000 DB.
I can't see why the If-then statement would fail.
Any suggestions? Can I use a detailed log to identify the column or data that is failing?
Margin is created by Sales / Qty. I have totals at a couple of groupings, so Margin is the Total(Sales) / Total(Qty).
In each Margin calculation I have used an if then statement.
If Total(Qty <> 0) then Total(Sales) / Total(Qty) else (0)
This works for for a few companies (there is a prompt and filter on comapny) but there are a number it doesn't work for. I get the error;
Error Number - 51
DMS-E-MATHEXCEPTION, An arithmetic exception was detected.
EXPENG-E-ZERO_DIVR, <Floating point> divide/mod by zero is invalid.
I'm querying against a SQL Server 2000 DB.
I can't see why the If-then statement would fail.
Any suggestions? Can I use a detailed log to identify the column or data that is failing?