8 Replies Latest reply: Nov 2, 2018 1:03 AM by Andrey Krylov RSS

    Comparison of string values

    Wong Dehou

      Hi Qlik community,

      I have 2 fields, CRSE_GRADE_OFF and SCORE_LETTER.
      CRSE_GRADE_OFF  include : A+,A,A-,B+,B,B-,C+,C,D+,D,P,F
      SCORE_LETTER include : A,B,C,D,F, E,M,P,S,U and X.


      I have created a dimension (Performance) in my table:

      =if(CRSE_GRADE_OFF<SCORE_LETTER and len(trim(CRSE_GRADE_OFF))>0

      ,'BETTER',

      if(CRSE_GRADE_OFF>SCORE_LETTER and len(trim(CRSE_GRADE_OFF))>0

      ,'WORSE',

      IF( CRSE_GRADE_OFF=SCORE_LETTER and len(trim(CRSE_GRADE_OFF))>0,'EQUAL')))

       

       

      Results:
      test.PNG

      testt2.PNG

       

      As shown, B+ should be 'BETTER' than B, but results show WORSE.

      Also if the CRSE_GRADE_OFF = P and SCORE_LETTER = E or M or S or U or X, I want the result to be better.

      However in the 2nd screenshot, it shows P as worse than M.

       

      Is there any way I can achieve this?

       

      Thank you so much in advance.