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

Announcements
Register by January 31 for $300 off your Qlik Connect pass: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
umanikhat
Contributor
Contributor

Need Help with looping through dates

Hi,

I am trying to store qvds based on each single day. I have the data In db as

Id, start, end 1, 1/1/2022, 1/30/2022

The above record was actually stored as one record in db but the record was available for 30 days. So in general I need 30 qvds with same record showing up. I was able to get the records seperated out but need help in storing the qvds using loop instead of manually doing the work.

Please provide your thoughts. Any help is highly appreciated!!

Labels (2)
1 Reply
Vegar
MVP
MVP

Try something like this.

set vStartDate = yearstart(today());

set vEndDate = yearstart(today(),-1);

For _date = vStartDate to vEndDate

DayData:

NoConcatenate Load '$(_date)' as Date,  id From Source 

Where [end]>=$(_date) and [start] <=$(_date);

Store DayData into Lib://QVD/Data_$(_date).qvd (Qvd);

Drop Table DayData;

Next _date