Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

for loop in qlikview with dates (BY WEEK)

http://community.qlik.com/thread/78869-- This for loop worked out great!

BUT I need to tweek it to loop by week, rather than loop each day..

Any suggestions on how I can accomplish that?

let vDays = num#((today()-1) - date#('1/01/2014','MM/DD/YYYY'));
FOR i= 0 to vDays
let vSuffix = Date((today()-1) - vDays + i, 'MM/DD/YYYY');

LOAD data

  NEXT i


Thank you in advance!

Liz

4 Replies
MarcoWedel

Hi,

one solution could be:

FOR i= 1 to Week(Today())

   LET vSuffix = MakeWeekDate(2014, i);

   //LOAD data;

   LOAD '$(vSuffix)' as Date

   AutoGenerate 1;

NEXT i;

QlikCommunity_Thread_135878_Pic1.JPG.jpg

hope this helps

regards

Marco

Not applicable
Author

Hello Marco,

do u know how can I do to do not fix weeks only for 2014 but for all years available into my date field?

I mean, I need one row for each month-year available in my database, not only 2013 or 2014.

Thanx!!

Pablo

MarcoWedel

Hi,

please open a thread and specify your requirements.

thanks

regards

Marco

Not applicable
Author

Hi Marco, thanks!

I just did it here: http://community.qlik.com/message/644577#644577

Pablo