3 Replies Latest reply: Dec 27, 2017 9:32 PM by phuc pham RSS

    Using "Admonths" in expression

    phuc pham

      Hi all,

       

      I need to count a number of customer using services in last 1m/3m or 6m, so that i set an expression like that:

      count({<[TransDate]={'>=$(admonths(today(),-1))'}>} distinct [Cus.No]) ==> for 1M

      count({<[TransDate]={'>=$(admonths(today(),-3))'}>} distinct [Cus.No]) ==> for 3M

      count({<[TransDate]={'>=$(admonths(today(),-6))'}>} distinct [Cus.No]) ==> for 6M

      However, all these three expressions show the same result!

       

      Please help me to correct that expression. Thank you!

       

      Regards,

      PhucPV

        • Re: Using "Admonths" in expression
          Sunny Talwar

          Try with an equal sign within the dollar sign expansion  and also switch single quotes to double quotes and see if that works

           

          count({<[TransDate]={">=$(=admonths(today(),-1))"}>} distinct [Cus.No]) ==> for 1M

          count({<[TransDate]={">=$(=admonths(today(),-3))"}>} distinct [Cus.No]) ==> for 3M

          count({<[TransDate]={">=$(=admonths(today(),-6))"}>} distinct [Cus.No]) ==> for 6M

          • Re: Using "Admonths" in expression
            Pablo Labbe

            When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others.