Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Formula help


Hi,

my question first:

=> Is there an easier (shorter) way of writing the condition

>>> A > 20 AND A <= 30 <<<

=> This might not seem like much, but I have to define a status light that has three potential outcomes (green/yellow/red), based on two separate limits (each of which can actually take on any of those three stati, which have to then be combined into one), which makes for an awful lot of brackets...

Thanks a lot!

Best regards,

DataNibbler

3 Replies
sujeetsingh
Master III
Master III

use nested if statement with AND operator

hic
Former Employee
Former Employee

A nested If() is the answer. But I don't think you need the AND. Instead you can do it like

If( A <= 20, 'Red',

If( A <= 30, 'Yellow',

     'Green')) as NewField

HIC

datanibbler
Champion
Champion
Author

Hi Henric,

that was what I intended to learn:

=> I know that in another software I worked with, the first (topmost) condition was tested first and then sort of taken for granted, so you wouldn't have to repeat it (in reverse form) as part of the second condition.

If that works in QlikView, that will save me some typework in this instance - well, I've already done it, so that would not make a difference, but it will make the whole thing easier to understand for others, and that's another thing I am aiming at.

Best regards,

DataNibbler

P.S.: Yep, it seems to work - at least the status_symbol is still there and for now it is even showing the same outcome that I had before. I'll just have to monitor it from time to time.