Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
richard_chilvers
Specialist
Specialist

Transpose, Crosstable, Something Else ?

Hi

I have a spreadsheet created by another system which looks like this:

CodeGradeABCDE
M1412Cruise12345
Flight231
M1413Cruise2468
Flight1

I would like to load the data as follows:

CodeGradeCruiseFlight
M1412A12
M1412B23
M1412C31
M1412D4
M1412E5
M1413A21
M1413B4
M1413C6
M1413D8
M1413E

Is this possible using Excel import parameters, or QV LOAD parameters? Or is this step too far?

Thanks

Richard

4 Replies
maleksafa
Specialist
Specialist

so first step you want to do is to fill the missing code, you can do that from the 'Enable Transformation Step' wizard, go to fill tab and do the setup there with the condition if the cell is empty to take the value from the above cell, this wizard will fill the missing cells.

then you want to use the cross table also from the import wizard to transform the above table (filled with all the cells) to your format.

Anonymous
Not applicable

This can be done with excel transformations and crosstable and with little bit joining. See the attachement.

richard_chilvers
Specialist
Specialist
Author

Thanks for both replies.

I will work with the attachment and modify it to my 'live' data. It looks promising

MarcoWedel

Hi Richard,

another solution could be:

table1:

CrossTable (GradeNew, Value, 2)

LOAD * FROM [http://community.qlik.com/thread/127821]

(html, codepage is 1252, embedded labels, table is @1, filters(

Replace(1, top, StrCnd(null))));

RENAME Field Grade to GradeOld, GradeNew to Grade;

Left Join (table1)

LOAD Distinct

  Code, Grade, AutoNumberHash128(Code, Grade) as ID

Resident table1;

table2:

Generic LOAD

  ID, GradeOld, Value

Resident table1;

DROP Field GradeOld;

QlikCommunity_Thread_127821_Pic2.JPG.jpg

QlikCommunity_Thread_127821_Pic1.JPG.jpg

This script should work regardless of the number of grade columns and values and without the need for any hardcoded field values.

hope this helps as well

regards

Marco