Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
It's just: crosstable(Type, Value, 5) load * from Source;
It's just: crosstable(Type, Value, 5) load * from Source;
Great - it works perfectly!
Thank you!