Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewforum
Creator II
Creator II

Issue when we add some values to the existing expression

The below expression does not work when I add "+21" to the Column(4), If we remove "+21" from the below expression it is working as expected. I tried using the actual expression and Label name instead of the Column(4) but no luck. Can someone please help on this.

if((Column(4)+21) < 22,'S1',
if(((Column(4)+21) >= 22 AND (Column(4)+21) < 84),'S2',
  if(((Column(4)+21) >= 84 AND (Column(4)+21) < 273),'S3',
   if(((Column(4)+21) >= 273 AND (Column(4)+21)<>'NA'),'S4','NA'
     )
    )
   )
  )

5 Replies
rahulpawarb
Specialist III
Specialist III

Hello Rikab,

Trust that you are doing well!

If possible, could you please share the application with sample data and desired output? This will help us to provide expected feedback.

Regards!

Rahul

Anil_Babu_Samineni

What are the values with Column(4). Can you try with Num()

if(Num(Column(4))+21 < 22,'S1', if(Num(Column(4))+21 >= 22 and Num(Column(4))+21 < 84),'S2',

if(Num(Column(4))+21 >= 84 and Num(Column(4))+21 < 273),'S3', if(Num(Column(4))+21 >= 273 and Num(Column(4)) + 21 <>'NA'),'S4','NA'))))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
jonathandienst
Partner - Champion III
Partner - Champion III

I don't see any syntax errors, but there is one logical error

(Column(4)+21)<>'NA'

This will always be true as you are comparing a number with a string.

It would be easier to spot errors if you removed the unnecessary parentheses.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Simply add a new expression to your chart, and put the following in the expression edit field:

=Column(4) + 21

Now observe what is happening with the expression results for different row values.

If this doesn't shed some light on what is producing unexpected behavior, then cut your expression into fout different parts and put each one of them in a different expression column. Because of being created as logical expressions, they should all produce either a 0 or a -1 value.

jonathandienst
Partner - Champion III
Partner - Champion III

I think this is what you are looking for:

if(Column(4) + 21 < 22, 'S1',

    if(Column(4) + 21 < 84, 'S2',

          if(Column(4) + 21 < 273, 'S3',

              if(Column(4) + 21 >= 273 , 'S4', 'NA'

             )

         )

    )

)

Or even simpler

if(Column(4) < 1, 'S1',

    if(Column(4) < 63, 'S2',

        if(Column(4) < 252, 'S3',

            if(Column(4) >= 252 , 'S4', 'NA'

            )

        )

    )

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein