Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Division By Zero 1

Status
Not open for further replies.

nt95

Technical User
Nov 22, 2006
2
CA
I have created the following field to calculate a Net Income %age by Customer:


iif(Sum ({DLOG.DLREV$},{CUST.CNAME})<=0,1,(Sum ({@Net Income},{CUST.CNAME})/Sum ({DLOG.DLREV$},{CUST.CNAME})*100))

I can scroll through the report until I get a Customer with a negative Net Income %age. Then I get a "Division by zero" error.

Any thoughts?
 
I have had this in reports before, and I think its the same as what ive doen to fix it try this.

Hope it works

if Sum ({@Net Income},{CUST.CNAME})<>0 then
if Sum ({DLOG.DLREV$},{CUST.CNAME})<>0 then
if(Sum ({DLOG.DLREV$},{CUST.CNAME})<=0,1,(Sum ({@Net Income},{CUST.CNAME})/Sum ({DLOG.DLREV$},{CUST.CNAME})*100)) else 0
 
Problem solved.

Thanks so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top