Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

IF Statement in Expression with multiple between statements

Hi,

I'm have difficulty creating an expression that will evaluate another expression and assign a point value based on a range of values.

Here is what Im trying to do

IF [ExpressionName] is between Value1 & Value2  return '1'

IF [ExpressionName] is between Value3 & Value4  return '2'

IF [ExpressionName] is between Value5 & Value6  return '3'

IF [ExpressionName] is greater than Value7  return '4'

This should be all contained in one expression and the values will need to be hard coded  Can someone please provide some guidance/help?

Thanks.

Brian

3 Replies
jerem1234
Specialist II
Specialist II

Something like:

if([ExpressionName]<Value1, 0,

if([ExpressionName]>=Value1 and [ExpressionName] <Value2, 1,

if([ExpressionName]>=Value2 and [ExpressionName] < Value3, 2,

if([ExpressionName]>=Value3 and [ExpressionName] <Value4, 3,

if([ExpressionName]>=Value4, 4

)))))

Hope this helps!

Not applicable
Author

Thanks, works perfectly.

MarcoWedel

Hi,

another solution could be:

Match(-1,

      vExpressionName >= 1 and  vExpressionName <= 2,

      vExpressionName >= 3 and  vExpressionName <= 4,

      vExpressionName >= 5 and  vExpressionName <= 6,

      vExpressionName >= 7)

QlikCommunity_Thread_147768_Pic1.JPG

hope this helps

regards

Marco