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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Divide By Zero Problem

Status
Not open for further replies.

theWavist

Programmer
Jun 9, 2007
2
How Do I write a calculation for a numeric data item that keeps giving me teh value of "/0" ?

the way I am currently writing it is

((fieldA - FieldB) / FieldB ) * 100)
 
You'll have to decide om the value of the calculation for a zero value of FieldB.
One solution is a case-construct::

Code:
CASE WHEN
FieldB = 0 THEN << certain value >>
ELSE ((fieldA - FieldB) /  FieldB ) * 100) END

However Cognos may have it's own solution for divide by zero problems..



Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top