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: 
OrbytaQliker
Contributor II
Contributor II

Transform a table

Hi everyone,

if a have a table with the following structure:

 

[  col1,col2,col3

col1Val1,2,3

col1Val2,4,5

col1Val3,6,7

];

and i wish to transform it like this

[colAndRow,Value

col1Val1col2,2

col1Val1col3,3

col1Val2col2,4

col1Val2col3,5

col1Val3col2,6

col1Val3col3,7

];

The first column contains the combination of the values of a specific column and all other column names,

and the second column contains the respective value in the base table.

 

Is this realizable in script?

Thank you!

Labels (2)
1 Solution

Accepted Solutions
2 Replies
Clement15
Creator III
Creator III

Hello, here is a solution to your problem. The order in the table is not the same but that should not pose a problem.

 

TEST:
load *
Inline [
col1, col2, col3

col1Val1,2,3

col1Val2,4,5

col1Val3,6,7

];


TEST2:
Load
col1&'col2' as colAndRow,
col2 as Valeur
resident TEST;

Concatenate

Load
col1&'col3' as colAndRow,
col3 as Valeur
resident TEST;

Nicolae_Alecu
Creator
Creator