Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need your help in script

Dear All,

I have to filter only for Current 10 weeks data while loading without hard-coding it, but am not aware how would i do that in script level.

looking forward for your help.

Thanks & Regards,

Venkat T

5 Replies
Not applicable
Author

Hi Venkat

Probably the best way would be to do it on database level. Which DBMS are you using? Please post your load statement

Lukasz

Not applicable
Author

Hi

Are you looking for the last 10 weeks (i.e. 70days) or the 10 weeks from last Sunday?

But you can use today() functionality against your dates and/or weeks in your load script.  For example;

Load

     *

From [FILE]

where today()>= [yourdate] and today()<=[yourdate];

How does this help?  Let me know how you get on.


Steve

Not applicable
Author

Sorry - slight amendment to what I wrote above;

Load

     *

From [FILE]

where [yourdate] + 70 >= today();

Gysbert_Wassenaar

Something like this:

LET vStart = num(today())-70;

SQL select * from mysource

where MyDate > $(vStart) ;

You may need to format the start date parameter value to the date format your database expects.


talk is cheap, supply exceeds demand
senpradip007
Specialist III
Specialist III

Try this:

 

LET vMaxDate = Num('31/12/2013');
LET  vMinDate = Num('01/01/2013');
tCal:
     LOAD

               $(vMinDate) + RowNo() - 1 As Date,
               Date($(vMinDate) + RowNo() - 1) As FormalDate,

     AutoGenerate ($(vMaxDate) - $(vMinDate) + 1);

Cal:
NoConcatenate

LOAD

          Date,
          FormalDate

Resident tCal
Where Date >= ($(vMaxDate) - (10*7) + 1);

DROP Table tCal;