Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have weekly data in qvd files (meaning I have one qvd file for each week). qvd file names are otherwise the same, but at the end I have the date changing - e.g. SNAPSHOT_20231016.qvd, SNAPSHOT_20231023.qvd & SNAPSHOT_20231030.qvd.
Now, I need to get the snapshot data from the last 20 weeks.
How can I load the data from these qvd files so that the latest 20 weekly files are read? What kind of script needs to be placed into Data load editor?
Thank you for your assistance!
This code will generate names of qvd files for latest 20 weeks
let vStartDate=num(today())-19*7;
let vEndDate=num(today());
Dates:
Load
distinct
date(weekstart(Date($(vStartDate) + IterNo()-1)),'YYYYMMDD') as qvdDate
autogenerate 1
WHILE $(vStartDate) + IterNo()-1 <= $(vEndDate);
for i=0 to NoOfRows('Dates')-1
let vQvdFileDate=Peek('qvdDate', i, 'Dates');
//LOAD * FROM [lib://Dane QVD/SNAPSHOT_$(vQvdFileDate).qvd] (qvd);
next i;
This code will generate names of qvd files for latest 20 weeks
let vStartDate=num(today())-19*7;
let vEndDate=num(today());
Dates:
Load
distinct
date(weekstart(Date($(vStartDate) + IterNo()-1)),'YYYYMMDD') as qvdDate
autogenerate 1
WHILE $(vStartDate) + IterNo()-1 <= $(vEndDate);
for i=0 to NoOfRows('Dates')-1
let vQvdFileDate=Peek('qvdDate', i, 'Dates');
//LOAD * FROM [lib://Dane QVD/SNAPSHOT_$(vQvdFileDate).qvd] (qvd);
next i;
Hi Adam! Thank you - this works perfectly! Much appreciated 🙏