6 Replies Latest reply: Jun 5, 2017 8:05 AM by Alejandro Martínez Otal

# If () condition not working as intended

Hello guys!

I created the following table

ProductDayMetric_1ObjectiveThreshold
110.560.5Y
210.320.5N
120.290.5N
220.60.5Y

What I want to do, is that if the value Metric_1 is higher than 0.5, put the value 'Y' in Threshold, otherwise, put 'N'.

I used the following formula in Threshold with no luck.

if([Metric_1] < 0.5,'Y','N')

it should be quite simple, isn't it?

I didn't add the formula for metric_1 here because I don't think its important, but I might be missing something crucial in Qlik as the condition seems pretty simple.

Kind regards!

• ###### Re: If () condition not working as intended

Hi,

The if statement looks correct

if([CONDITION] > 0.5, TRUEPART, FALSEPART )

A few things you can check is your condition and whether you need to give 0.5 as '0.5' (i.e If the value is numeric or text)

• ###### Re: If () condition not working as intended

Dear Janani,

Thanks for your answer, unfortunately it was all my mistake! I was looking at the wrong metric.

Kind regards,

Alejandro.

• ###### Re: If () condition not working as intended

Are you calculating the "If statement" during the Load or directly in the table ?

Have you declared the formula as an expression or as a calculated dimension ?

• ###### Re: If () condition not working as intended

Hello Michele,

I was looking at the wrong metric, it work as intended now!

• ###### Re: If () condition not working as intended

Hi,

Are you trying to reference a Column Name in the chart, as opposed to a field?

I remember that you can do that in QlikView but I'm not sure that you can do that in Sense.

Can you try putting the formula from the Metric_1 expression into the Threshold expression  (in place of [Metric_1])?