2 Replies Latest reply: Dec 5, 2017 3:50 AM by Varun Prakash Paulraj RSS

    Problem with "AddMonths" , and displaying results for the previous month

    JC Labeau


      Newbie question here. I am very excited to finally work with Qlik...but the syntax is a bit of a mystery...

      I have been through the forums back and forth and tried so many combinations of this already...


      I am using the latest version of Qlik Sense server.

      I am trying to display the number of accounts for specific periods


      My date filed is: "System_Date"


      I have 2 variables: the last month , and the previous month

         Set vMax_System_Date = Max(System_Date) ;

         Set vMax_System_Date_minus_1 = AddMonths(Max(System_Date),-1,1) ;


      They both work when I display the results in a KPI


      The following formula works and gives me the count for the last month:

         =count(   { $< System_Date = {'$(=$(vMax_System_Date))'}  >} Account_ID )


      If I substitute the variable for the previous month variable, it does not work:

         =count(   { $< System_Date = {'$(=$(vMax_System_Date_minus_1))'}  >} Account_ID )


      Anybody knows what to do, and more importantly...why?


      Many thanks in advance!