1 Reply Latest reply: Oct 24, 2017 8:26 AM by Felip Drechsler RSS

    can we have multiple true values in if

    siddharth soam

      I want to have multiple true values for a condition in if statement in qliksense

       

      ex-

       

      quarter   previous quarters

      3                 1

                         2

       

       

      please help me with the problem

        • Re: can we have multiple true values in if
          Felip Drechsler

          Hi Siddhart,

           

          If I understood your question, you need to create a table with previous quarters based on quarter values.

           

          The following script:

           

          x:

          Load * Inline

          [

          Quarter

          1

          2

          3

          4

          ];

           

          y:

          Load

          Quarter,

          if (Quarter=1,Null(),IterNo()) as [Previous Quarter]

          Resident x

          While IterNo() <=Quarter;

           

          drop table x;

           

          NoConcatenate

          data:

          Load

          Quarter,

          [Previous Quarter]

          Resident y

          where Quarter <> [Previous Quarter];

           

          drop table y;

           

          Gets the following output:

          Sample.png

          Since you now have the Quarter and Previous Quarter mapped out, now you could do the if statement on the new field.

           

          Is that what you need?