2 Replies Latest reply: Dec 28, 2010 9:29 PM by John Witherspoon

# Conditional: numeric values problems!

Hi,

On one hand,

I'm trying to use a simple IF sentence but I've some problems because I want to compare the value result of an operation with a decimal number:

if (
(Sum (service_availability_hourly.seconds_ok)/(Sum (service_availability_hourly.seconds_ok)+Sum (service_availability_hourly.seconds_not_ok)))>"1.01",
'qmem://<bundled>/BuiltIn/arrow_ne_g.png',

if (
(Sum (service_availability_hourly.seconds_ok)/(Sum (service_availability_hourly.seconds_ok)+Sum (service_availability_hourly.seconds_not_ok)))<"0.99",
'qmem://<bundled>/BuiltIn/arrow_se_r.png')
)

How could I compare the exprsion with numbers?

On the other hand,

I've calculated the expressions before in a different column of the same table. Should I recalculate the values again in the IF condition or could I take advantadge of the previous calculation. How could I do it?

Thank you!

• ###### Conditional: numeric values problems!

Hello,

In the first case: you care comparing a numeric value (the result of your Sum function) to a string "1.01" Instead, you should compare to a number 1.01 (without quotes).

For the second: If the previous expression is called "Service Availability" you can use in a different expression in the same chart using

`[Service Availability] + Sum(Whatever)`

Hope this helps

• ###### Conditional: numeric values problems!

Also note that A/(A+B) = 1/(1+B/A), so you may be able to avoid recalculating A in that way.