6 Replies Latest reply: Sep 21, 2018 12:03 PM by Shahbaz Khan Mohammed RSS

    Using If Statement with Specific Date as Condition

    Raihana Ms

      Hi All,

       

      I'm new to Qlik Sense and I'd need help on the following measure. I'm trying to do the following :

       

      1) For transaction with date / [TDATE] equal to or after 1st July 2018, count TCODE with [TAMT] equal to or more than 5000, and, of [TTC] equal to A or  B or  C or  D

       

      2) For transaction with date / [TDATE]  before 1st July 2018, count TCODE with  [TTC] equal to A or  B or  C or  D

       

      The data would look like something like this :

         

      TCODETTCTDATETAMT
      AWSEA7/1/20185000
      DVFFBB2/1/20184800
      SVSVFC6/30/2018400
      CVSFFWD7/1/20180
      AWSEE2/1/201860
      DVFFBA6/29/2018956
      SVSVFC6/30/20183456
      CVSFFWC5/1/201890000
      SVSVFD3/4/20180

       

       

      I created this variable for comparison :

      varDateImplemetation = Date(Date#('7/1/2018', 'MM/DD/YYYY'),'MM/DD/YYYY')

       

      And the following measure for a graph :

       

      IF ([TDATE]>=varDateImplemetation,

           COUNT({$<[TAMT]={'>=5000'},[TTC]={'A','B','C','D'}>} TCODE),

           COUNT({$<[TTC]={'A','B','C','D}>} TCODE))

       

      However the formula always return a false statement. I think something is wrong with the date comparison, but can someone point out where it may be wrong? I've double checked my dates by referring  Why don’t my dates work? and it looks good so far. But I still can't make it work.

       

       

      Please help. Thanks!