0 Replies Latest reply: Mar 13, 2018 2:57 AM by Neeraj Kumar Singh RSS

    Can we write switch case statement instead if-else while creating calculated columns?

    Neeraj Kumar Singh

      Hi All,

       

      I need to create one calculated column and I am able to create using if-else statement:

       

      if(x=1,'XYZ1',

      if(x=2,'XYZ2',

      if(x=3,'XYZ3',

      if(x=4,'XYZ4',

      if(x=5,'XYZ5',

      if(x=6,'XYZ6',

      if(x=7,'XYZ7',

      if(x=8,'XYZ8',

      if(x=9,'XYZ9',

      if(x=10,'XYZ10',

      if(x=11,'XYZ11',

      if(x=12,'XYZ12',

      'Other'))))))))))))

       

      I tried to replace the if-else statement with switch case statement but could not able to do. I am very new to Qlick Sense. Could you please suggest me that is that possible to write a switch statement while creating calculated column? If Yes please give me sample script snippet by considering above if-else statement example.