Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

baarathi
Contributor II

Addmonths

Load *;

Sql select

* from dm.db

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


Is there any equivalent function function for addmonths in sql ?

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Addmonths

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.

2 Replies
MVP
MVP

Re: Addmonths

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.

baarathi
Contributor II

Re: Addmonths

Thank you sir.

Community Browser