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

Transposing data

Hi,

I have a certain data set that I want to transpose. 

Input:

Company | vege.label | vege.price | meat.label | meat.price 

A | tomatoes | 3 | beef | 5

B | tomatoes | 2 | beef | 10

C | tomatoes | 3 | beef | 8

 

Output:

Company | tomatoes | beef

A | 3 | 5

B | 2 | 10

C | 3 | 8

 

Thanks in advance!

Labels (1)
1 Solution

Accepted Solutions
AlzhanNurtaza
Contributor III
Contributor III

Hey! You try Generic Load, but in reality in depends on your source data.

If you want one table using loop Concatenate them

 

 

T1:
Load * inline [
Company,vege.label,vege.price,meat.label,meat.price 
A,tomatoes,3,beef,5
B,tomatoes ,2, beef,10
C,tomatoes,3,beef,8
];

T2:
generic
Load 
Company,vege.label,vege.price
Resident T1;


T3:
generic
Load 
Company,meat.label,meat.price 
Resident T1;

drop table T1;


 

 

View solution in original post

2 Replies
AlzhanNurtaza
Contributor III
Contributor III

Hey! You try Generic Load, but in reality in depends on your source data.

If you want one table using loop Concatenate them

 

 

T1:
Load * inline [
Company,vege.label,vege.price,meat.label,meat.price 
A,tomatoes,3,beef,5
B,tomatoes ,2, beef,10
C,tomatoes,3,beef,8
];

T2:
generic
Load 
Company,vege.label,vege.price
Resident T1;


T3:
generic
Load 
Company,meat.label,meat.price 
Resident T1;

drop table T1;


 

 

iglou
Contributor II
Contributor II
Author

Got it. Thanks!