2 Replies Latest reply: Mar 12, 2018 6:27 AM by Baarathi V RSS


    Baarathi V

      Load *;

      Sql select

      * from dm.db

      Where monthstart([YourMonthYear])  >= monthstart(addmonths(today(),-12));

      Is there any equivalent function function for addmonths in sql ?

        • Re: Addmonths
          Petter Skjolden

          It depends on the SQL dialect that your database is using. The SQL statement in Qlik sends everything after the SQL and before the semicolon to the database driver that you are using and it is up to the SQL database and driver to interpret it and return some results.


          For Microsoft SQL Server you can use the DATEADD( month , 1 , SalesDate ) as an example.


          For Oracle you can use ADD_MONTHS( SalesDate , 1 ) as another example.


          So you will have to look at the documentation for your particular SQL database.