1 Reply Latest reply: Dec 11, 2011 10:04 AM by Stefan Wühl RSS

    how to compare two fields in expression

      Hi i'm kinda new to qlikview and i have this problem. i have two fields from diferrent excel file column and i need to compare them using formula in expression.

      Example:

       

      Field1           Field2

      Car              Car2

      Mazda          Merzedez 

      Honda           Honda

      Toyota          Hyundai

       

      now i need expression formula for each result, their data similaries and difference.

       

      Result:

      Mazda

      Merzedez

      Toyota

      Hyundai

       

      Result:

      Honda

       

      Please help me. I'm struggling to find a solution T_T. Thanks in advance,

        • how to compare two fields in expression
          Stefan Wühl

          You could do it like this in the script:

           

          Field1:

          LOAD * INLINE [

          Field1

          Car

          Mazda

          Honda

          Toyota

          ];

           

          Field2:

          LOAD * INLINE [

          Field2

          Car2

          Merzedez

          Honda

          Hyundai

          ];

           

          Result2:

          Load

          Field2 as Result2 resident Field2 where exists(Field1, Field2);

           

          Result1:

          Load Field1 as Result1 resident Field1 where not exists(Field2,Field1);

          Load Field2 as Result1 resident Field2 where not exists(Field1,Field2);

           

          Hope this helps,

          Stefan