11 Replies Latest reply: Apr 14, 2014 2:28 PM by Massimo Grossi RSS

    Inserting field with an if statement

    Matt Maino

      Hi everyone,


      I have imported a few SQL database tables into my qlikview worksheet, but I am interested in creating a new field on this import and can't seem to get it to work.


      This is what the non-working code looks like:






      if(Field1 < 30, 'current'),

      if(Field1 > 29 AND Field 1 <60, '30-59'),

      if(Field1 > 59 AND Field1 < 90, '60-89'),

      if(Field1 > 89 AND Field1 <120, '90-119'),

      if(Field1 > 119, '120+') as [Description]

      FROM SQL table name;

      If you can't tell from the code I am trying to use logic based on field1 to insert specific strings into a new field called Description. Does anyone know what I am doing wrong?

      Thank you