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

Segmentation of Data

Hi All,

I have an excel sheet having a date column "Start_Date" and the values in it is like :

2010-01-01

2010-02-01

2011-03-01

I need to segment this data in the new file with below rules :

1) if the year is 2010, then create a new folder in the directory 2010

2) if the month is 01, then create a new folder in the 2010 directory 01

And so on..

After that i need to create a file inside these folders like :

1) If the "Start_date" value is 2010-01-01, then create a file for data having "Start_date" like 2010-01-01 only inside directory 2010/01/<file_name>.csv

I tried it and the solution I found is reading the data multiple times then finding unique values and so on, but is there any other fast way to do that?

Thanks in advance

Labels (2)
1 Reply
Anonymous
Not applicable

Hi

My idea is to iterate each rows and extract the year, month number from the Start_date column, store these value to context variables, the output file path will be dynamic, like:

"D:/file_path/"+context.year_directory+"/"+context.month_directory+"/file_name.csv"

 

The job looks like:

tFileInputExcel--main--tFlowToIterate--iterate--tjava--oncomponent--tFixedFlowInput--main--tFileOutputDelimited

 

Check the 'Create directory if it does not exist' box in the advanced settings tab of tFileOutputDelimited.

 

Regards

Shong