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: 
everest226
Creator III
Creator III

Splitting files ino multiple QVD from CVS file

HI expert,

I have CSV file which had a field name base date  from 2015 to 2019 . i want to create multiple qvd based in Date field ,

 

LOAD

CAPNumber ,
Date(Base Date,'MM/DD/YYYY') as [Orginal Date],

 

From,,,,,

Store ---- into ----

Labels (1)
1 Reply
trdandamudi
Master II
Master II

Below is a small sample I created  and hope this helps:

Data:

Load * Inline [
RecNo,Base_Date,Year,Amount
10,01/10/2015,2015,100
20,01/10/2016,2016,200
30,01/10/2017,2017,300
40,01/10/2018,2018,400
50,01/10/2019,2019,500
50,01/10/2019,2019,600
];


DistinctYearsTable:
LOAD Chr(39) & CONCAT(DISTINCT "Year",
Chr(39) & Chr(44) & Chr(39)) & Chr(39) AS DistinctYears
resident Data;

LET vDistinctYears = FieldValue('DistinctYears', 1);
DROP TABLE DistinctYearsTable;


FOR EACH vYear IN $(vDistinctYears)
CurrentYear:
NoConcatenate
LOAD * Resident
Data
WHERE Year = '$(vYear)';


STORE CurrentYear INTO 'C:\Temp\Data-$(vYear).qvd';
DROP TABLE CurrentYear;
NEXT

Drop Table Data;