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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Create For loop for 36 Months

Hello Guys,

Could you please let me know how do I create a

For loop for 36 months .

Thanks,

Ravi

11 Replies
Anonymous
Not applicable
Author

Thanks Petter,

[DurationFlow3]:

Load

"Impact month",  // has value of 12

"Duration" // has value of 4

FROM [lib://AttachedFiles/Complexity_Mix.xlsx]

(ooxml, embedded labels, header is 1 lines, table is Model);

Let vImpact_Month=Peek('Impact month',0,DurationFlow3);

For i=1 to 36

    

     For x=1 to 4    // here I want ( For x= 1 to Duration)  from table  [DurationFlow3]:    Rest all code is fine for me , Just need this for loop ...

     if $(i) =1 then

         test:

          load

          $(i) as Month,

          $(x) as Month2,

          $(vImpact_Month) as value

          AutoGenerate 1;

   

     ELSE

      test:

          load

          $(i) as Month,

          $(x)+($(i)-1) as Month2,

            $(vImpact_Month) as value

          AutoGenerate 1;

     ENDIF

    

     NEXT x;

NEXT i;

Anonymous
Not applicable
Author

Thanks Petter ,

I was able to Solve the issue . I did something like this  and it worked for me .....Thanks a lot for the support , I appreciate your suggestions

let vDuration= Peek('Duration',0,Duration_table);

for x=1 to $(vDuration)