Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
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!