Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

qlikview script & select data without specifying the dates

Hi ,

how do I  select data without specifying the dates in qlikview script?

For example today's date minus 6 months, that is select data for the last 6 months.

5 Replies
chrisg
Partner - Creator III
Partner - Creator III

Hi,

do you have already a loadscript. Can you provide an example?

Manx thx

Christoph

Do or Do Not. There is no try!
Anonymous
Not applicable
Author

Hi,

Maybe you can use the function addmonths() addmonths ‒ QlikView

Using e.g. AddMonths(Today(),-6) will return 2016/01/25 (given that today is 2016/07/25).  So, if you use this function in the where clause of your load script (e.g. Where Date >= AddMonths(Today(),-6)), it should return you all data for the last 6 months.

Good luck.

Anonymous
Not applicable
Author

thanks but I have an error:

ADDMonths.PNG

WHERE   DATE>= (AddMonths(Today(),-6));
Not applicable
Author

Hi Sukai,

If following is my test data,

  

ReloadDateReloadBy
7/25/2016A
6/1/2016B
5/2/2016C
4/3/2016D
1/1/2016E
12/10/2015F
8/12/2015G
5/7/2015I

Please write the following script and Reload it,

LET vVar = Num(Date(Today()));

TestLoad:

LOAD * Where Num(ReloadDate)>=$(vVar1)-180;

LOAD ReloadDate,

     ReloadBy

FROM

[..\Note Of Qlikview Learnings\Static_Data\Test Load.xlsx]

(ooxml, embedded labels, table is [Last 6Mnths data]);

Following records which fall under last 6 month period will be the output,

  

ReloadDateReloadBy
7/25/2016A
6/1/2016B
5/2/2016C
4/3/2016D

Thanks,

Narsi

maxgro
MVP
MVP

AddMonths is a Qlik function

In the SQL part of the script you need database function (I think an IBM db2 from youir image)

In the Qlik part you can use Qlik functions (AddMonths)

It seems you used some Qlik functions (today, addmonths) in SQL, you can't

// Qlik

Load Date#(OrderDate,’YYYYMMDD’) as OrderDate,

AddMOnths.......,

............

;

// DB

SQL SELECT OrderDate

FROM … ;



Here for more detail

Preceding Load