Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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!

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

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

View solution in original post

2 Replies
Miguel_Angel_Baeyens

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

johnw
Champion III
Champion III

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