Qlik Community

QlikView Documents

Documents for QlikView related information.

Split Data YearWise QVDs

neetha_p
Honored Contributor

Split Data YearWise QVDs

//Yearly QVD:

TempTable:
LOAD Distinct Year(Date) AS Year
FROM QVD\Main.qvd(qvd)
Order by Year(Date) asc;

NoConcatenate

Table:
Load Year,Min(Year) as minYear, max(Year) as maxYear
Resident TempTable;

Let vMin=Peek('minYear', 0, 'Table');
Let vMax=Peek('maxYear', 0, 'Table');

FOR i=$(vMin) to $(vMax)
LET vYear = Peek('Year',$(i),'Table');

YearWise:
NoConcatenate
LOAD * FROM QVD\Main.qvd(qvd)
Where Year(Date) = '$(vYear)';

STORE YearWise into TableName_$(vYear).qvd;
DROP Table YearWise;

Next

DROP Table TempTable;
DROP Table Table;

Comments

Hi

You can read the same here for yearly QVD creations. With exactly same logic used before in my documents.

Year Wise Qvd creation from Source Data

Regards

Anand

Vegar
Valued Contributor

Are you sure that your min max calculation will work?

Correct me if I'm wrong. Grouping by year will make both min and max to be the same? I would suggest removing the group by statement.

Table:

Load Min(Year) as minYear, max(Year) as maxYear

Resident TempTable

;

Not applicable

HI,

If you are grouping by year the Min and Max of years  will give the same value.

So vMin and vMax will hold same values.


So the splitting of years will not work i think.

Please recheck


Best Regards,

Avinash Jagilenki

neetha_p
Honored Contributor

Thanks  Vegar and Avinash

Regards

Neetha

bhagirath
Contributor III

Table:


Replace below
Load Year,Min(Year) as minYear, max(Year) as maxYear
Resident TempTable;


with this

Load Min(Year) as minYear, max(Year) as maxYear
Resident TempTable;

Version history
Revision #:
1 of 1
Last update:
‎01-20-2015 08:13 AM
Updated by: