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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
zagzebski
Creator
Creator

Loop using new variables

I don't how to accomplish the following. I want to take a table like the one below and loop through to create multiple tables each utilizing a different where clause based on dates. the first where clause would be like below, then MonthYear >=201002, then MonthYear >=201003, and so on.  Somehow use a variable in where clause?Any ideas on a good method to accomplish this?

For i = 1 to 50

SalesbyRange:

Select *

From Resident Sales

where MonthYear >=201001;

Next

Thanks in advance,

Steve

1 Solution

Accepted Solutions
Not applicable

don't know what you are trying to accomplish but your loop would be:

LET _MyStart = 201000;

SalesbyRange:

FOR _i = 0 to 50;;

LOAD * Resident Sales WHERE MonthYear >= $(_MyStart)+$(_i);

NEXT _i;

View solution in original post

2 Replies
Not applicable

don't know what you are trying to accomplish but your loop would be:

LET _MyStart = 201000;

SalesbyRange:

FOR _i = 0 to 50;;

LOAD * Resident Sales WHERE MonthYear >= $(_MyStart)+$(_i);

NEXT _i;

zagzebski
Creator
Creator
Author

Thanks Mario. This is a good start for me to get this accomplished!

Steve