Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Prabhu1204
Creator
Creator

3 years of data

Hello All,

I have a qvd with incremental logic. That qvd should always have only 3 years of data. Could you please help me on the logic.

I used the below script for incremental load

 

Tmp:
Load IndexDate From [lib://XXX.qvd](qvd);

MaxTimestamp:
Load Timestamp(MaxIndexDate)as MaxDate Resident Tmp;

Drop Table Tmp;

Let VMaxDate = Peek('MaxDate', 0 , 'MaxTimestamp');

Drop Table MaxTimestamp;

LIB CONNECT TO 'XXXX';

Load * ,Today() as LoadDate,
'Incremental' as Flag;

ABC:

SELECT * FROM dbo.ABC
WHERE IndexDate > '$(vVMaxDate)';

Concatenate

Load * From
[lib://ABC.qvd](qvd)
Where not Exists(ID);

Store ABC into
[lib://ABC.qvd](qvd);

Drop Table ABC;

-Prabhu
Labels (1)
1 Solution

Accepted Solutions
MayilVahanan

Hi @Prabhu1204 

Before store statement, try like below

ABCFinal:

Noconcatenate

Load * resident ABC where Year(IndexDate) >= Year(Today())-3;

Store ABCFinal into
[lib://ABC.qvd](qvd);

Drop tables ABC, ABCFinal;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

1 Reply
MayilVahanan

Hi @Prabhu1204 

Before store statement, try like below

ABCFinal:

Noconcatenate

Load * resident ABC where Year(IndexDate) >= Year(Today())-3;

Store ABCFinal into
[lib://ABC.qvd](qvd);

Drop tables ABC, ABCFinal;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.