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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
a-5
Contributor III
Contributor III

Transposing data - crosstable with multiple rows as key

Hi,

My data table is in the below format:

Customer Year Month Object Product Sales Units Gross margin
A 2023 1 1234 Car 1000 1 500
B 2023 3 1345 Bike 123 2 30

 

And I need to transpose it to the format below:

Customer Year Month Object Product Type Value
A 2023 1 1234 Car Sales 1000
A 2023 1 1234 Car Units 1
A 2023 1 1234 Car Gross margin 500
B 2023 3 1345 Bike Sales 123
B 2023 3 1345 Bike Units 2
B 2023 3 1345 Bike Gross margin 30

 

Can you please advise how to do this transpose/data structure change?

I tried to do it with crosstable, but not sure how to do  the "transpose" with so many fields as "keys".

Thank you in advance! 

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer
MVP
MVP

It's just: crosstable(Type, Value, 5) load * from Source;

View solution in original post

2 Replies
marcus_sommer
MVP
MVP

It's just: crosstable(Type, Value, 5) load * from Source;

a-5
Contributor III
Contributor III
Author

Great - it works perfectly!

 

Thank you!