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: 
kaustubh
Creator
Creator

IF statement with Not Equal to a value and equal to three other values

=IF( [Appt Duration] = 20 OR [Appt Duration] = 25 OR [Appt Duration] = 30, [Appt Duration])

 

I have written above expression in Set Analysis. According to my understanding it should exclude all the Other values having Duration 15,60, etc and must include only those having duration 20,25,30.

Can someone please help me understand this expression and does it do what I need it to do in correct manner. other suggestion and techniques are welcome.

I only want the values belonging to 20, 25, 30 So that I have dimension of it as stacked.But still it is fetching data that does not belong to 20,25,30 as separate Bar.

Example:

Duration

20

20

25

30

15

45

60

25

1 Solution

Accepted Solutions
rbartley
Specialist II
Specialist II

Hi, 

 

Your expression 

 

=IF( [Appt Duration] = 20 OR [Appt Duration] = 25 OR [Appt Duration] = 30, [Appt Duration])

is not set analysis, it's an if statement.  Set analysis is generally only used for restricting measures, e.g.

Sum({<[Appt Duration]={20,25,30}>} Measure)

That said, your If() statement should be ok.  I suggest you upload your app (zip it first else it won't work) so that we can help.

 

 

 

 

View solution in original post

5 Replies
m_woolf
Master II
Master II

This expression:

[Appt Duration] =- 15  AND [Appt Duration] = 15

will never be true

kaustubh
Creator
Creator
Author

Meaning? What exactly is going on here. i am new to App Development in Qlik Sense. I also want the values belonging to only 20, 25 30 and no others.

rbartley
Specialist II
Specialist II

Hi, 

 

Your expression 

 

=IF( [Appt Duration] = 20 OR [Appt Duration] = 25 OR [Appt Duration] = 30, [Appt Duration])

is not set analysis, it's an if statement.  Set analysis is generally only used for restricting measures, e.g.

Sum({<[Appt Duration]={20,25,30}>} Measure)

That said, your If() statement should be ok.  I suggest you upload your app (zip it first else it won't work) so that we can help.

 

 

 

 

kaustubh
Creator
Creator
Author

Thanks Rbartley.

The expression you gave did the trick. But Can i please know about the think of Not Equal to syntax and use in Qlik Sense?

rbartley
Specialist II
Specialist II

To exclude values use -=, so to exclude 15 and 60:

 

Sum({<[Appt Duration]-={15,60}>} Measure)

 

Of course, if you specify a list of values to include for a given dimension, you don't need to specify those to exclude for the same dimension unless you specify a range of values where one range does not logically exclude the other.  So,

Sum({<[Appt Duration]={">10"},[Appt Duration]-={30}>} Measure)

would give you all the durations greater than 10 excluding 30.