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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create monthly QVD ?

I have a qvd file that i need to create from monthly qvd like " 201601.qvd "

How can i do this ?

46 Replies
qlikview979
Specialist
Specialist

Hi,

Can you share your files.




Regards,

Mahesh

Not applicable
Author

I cannot im sorry.

I just need to create monthly qvd from the date column in the file.

The output of the qvd should be like 201601.qvd 201602.qvd etc.. and up to Max Date ( Month)  in the qvd.

qlikview979
Specialist
Specialist

Hi  This is help full

Load your QVD then  copy the Bold Script  may be it will work.

T1:

LOAD Date,

     Date1,

     Product,

     Sales

FROM

(qvd);

let Vm=NoOfRows('T1');

for i=0 to $(Vm)-1;

LET Vmonth=Date(Peek('Date',$(i),'T1'),'YYYYMM');

LET Vday=Peek('Date1',$(i),'T1');

STORE  T1 into $(Vmonth).qvd (qvd);

NEXT i;





Note:-  check both QVD names is same.like 201601.qvd]

qlikview979
Specialist
Specialist

Hi Akintosh,

Try With My QVD  SCript You will get correct output.

After load your QVD copy this

let Vm=NoOfRows('T1');               //////Give your table name////

for i=0 to $(Vm)-1;

LET Vmonth=Date(Peek('Date',$(i),'T1'),'YYYYMM');

LET Vday=Peek('Date1',$(i),'T1');

STORE  T1 into $(Vmonth).qvd (qvd);     /////give your path///

NEXT i;

Regards,

Mahesh

Not applicable
Author

I will, but what is " Date1 " ?

qlikview979
Specialist
Specialist

Hi,

Thats my one of the field name  i used that for "Daily QVD's" Creation.

tamilarasu
Champion
Champion

Not tested. But try this,

MyQVD:
Load * From yourQVDFile;

Max:
Load Max(Date) as MaxDate,
Min(Date) as MinDate,
Min(Num(Month(Date))) as MinMonth,
Max(Num(Month(Date))) as MaxMonth 
Resident MyQVD;

Let vMinDate = Date(Peek('MinDate',0,'Max'),'YYYYMM');
Let vMaxDate = Date(Peek('MaxDate',0,'Max'),'YYYYMM');
Let vMinMonth = Date(Peek('MinMonth',0,'Max'),'YYYYMM');
Let vMaxMonth = Date(Peek('MaxMonth',0,'Max'),'YYYYMM');

DROP Table Max, MyQVD;

FOR year = Year($(vMinDate)) to Year($(vMaxDate))
FOR month = $(vMinMonth) to $(vMaxMonth)
Let vDate = $(year) & Left('0' & $(month) ,2);

MyTable:
LOAD *
FROM
yourQVDFile (
qvd)
where Year(Date) = $(year) and MONTH(Date) = $(month);
STORE MyTable INTO $(vDate).qvd;

NEXT
NEXT

qlikview979
Specialist
Specialist

Hi Nag Bro,

Can you check once I think my script will work

T1:

LOAD Date,

     Date1,

     Product,

     Sales

FROM

(qvd);

let Vm=NoOfRows('T1');

for i=0 to $(Vm)-1;

LET Vmonth=Date(Peek('Date',$(i),'T1'),'YYYYMM');

LET Vday=Peek('Date1',$(i),'T1');

STORE  T1 into $(Vmonth).qvd (qvd);

NEXT i;



Regards,

Mahesh

Not applicable
Author

Hello Mahesh,

The OutPut of qvd should be with max year of the Date column and every month of what is in the Date Column

So :

201601.qvd

201602.qvd

201603.qvd

. Not just Month.

qlikview979
Specialist
Specialist

Hi ,

Please check this is my source like three files.