Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Amelia_96
Contributor III
Contributor III

Transpose data in data script

Hi, i'm trying to transpose data but making it distinct by ID. Is there anyone who knows how to do this in qlikview script?

Here is the sample data:

Amelia_96_0-1604904195132.png

 

Here is the expected output:

Amelia_96_1-1604904225600.png

Please help. Thank you in advance!!

2 Replies
MayilVahanan

Hi @Amelia_96 

Try like below. 

T1:
Load * Inline
[
ID, Category
a1, small
a1, medium
a1, large
a2, small
a3, medium
a3, large
a4, small
a5, small
a5, medium
a5, large
a5, extra large
];

Load ID, SubField(Cat, '|', 1) as C1, SubField(Cat, '|', 2) as C2, SubField(Cat, '|', 3) as C3, SubField(Cat, '|', 4) as C4;
LOAD ID, Concat(Category, '|', Category) as Cat Resident T1
group by ID;

Drop table T1;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Amelia_96
Contributor III
Contributor III
Author

Thank you so much. This helps a lot.