Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

baarathi
Contributor II

Loading past 10 months data

Load *;

SQL Select *

from DM.Da

Where monthstart(CreatedDate,'YYYY-MM-DD')  >= Date(monthstart(dateadd(month,-10,Today(),'YYYY-MM-DD'));

this statement throws an error, monthstart is not avaible in sql server. How can i load data for past 10 months ?

Tags (2)
12 Replies
baarathi
Contributor II

Re: Loading past 10 months data

YoussefBelloum
Esteemed Contributor

Re: Loading past 10 months data

Hi,

I'm not very good at the sql syntax, but with Qlik engine you can do this:

Load *

where CreatedDate>= AddMonths(Today(), -6);

SQL Select *

from DM.Da;

make sure to evaluate your CreatedDate field on the load and format it the right way.

baarathi
Contributor II

Re: Loading past 10 months data

sir, But the problem of doing it in Load instead of SQL is it's time consuming.

baarathi
Contributor II

Re: Loading past 10 months data

mto

Re: Loading past 10 months data

I think some of the functions that you are using here might be Qlik specific functions.... such as Today(), MonthStart... I know Oracle uses SYSDATE for Today() and something like ADD_MONTH for AddMonths and Trunc to get MonthStart... etc... suggest you to talk to your DB guys to give you a way to restrict this to 10 months....

baarathi
Contributor II

Re: Loading past 10 months data

Ya right. I could find equivalent function for Today as GetDate, But for monthstart could not find such match?

Re: Loading past 10 months data

Which database are you pulling the data from?

baarathi
Contributor II

Re: Loading past 10 months data

SQl server 2014 Management Studio

Re: Loading past 10 months data

Community Browser