Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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

Tags (4)
4 Replies
MarcoWedel
Not applicable

Re: for loop in qlikview with dates (BY WEEK)

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

Re: for loop in qlikview with dates (BY WEEK)

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
Not applicable

Re: for loop in qlikview with dates (BY WEEK)

Hi,

please open a thread and specify your requirements.

thanks

regards

Marco

Not applicable

Re: for loop in qlikview with dates (BY WEEK)

Hi Marco, thanks!

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

Pablo