Calculated Field

Doing a BAQ and I have this calculated field in it
( JobAsmbl.TLESetupHours + JobAsmbl.TLEProdHours ) / ( JobAsmbl.TLASetupHours + JobAsmbl.TLAProdHours )

the syntax is OK but it returns
Severity: Error, Table: , Field: , RowID: , Text: Divide by zero error encountered.

when I run the query

any suggestions

Try using a case statement so that it doesn’t automatically fail if you divide by zero.
Ex. Case when JobAsmbl.TLESetupHours is not null then ( JobAsmbl.TLESetupHours + JobAsmbl.TLEProdHours ) / ( JobAsmbl.TLASetupHours + JobAsmbl.TLAProdHours ) end

see example here

you need to use nullif in denominator

Thanks Olga! Saved my morning.

1 Like