Forum Discussion
Anonymous
7 years agoNot applicable
Unpivot data into multiple columns
Hello, I have a data set with the following structure (columns) Attribute SalesYear1 SalesYear1 SalesYear1 CostYear1 CostYear2 CostYear3 I would like to transform this into the followin...
- 7 years ago
Duplicate the query.
In one, unpivot the Sales columns and remove the cost columns.
In the other, unpivot the Costs and remove the sales columns.
In each query, alter the data so you have Year in a column by itself
'Merge as New' the two queries on Year and Division (Inner Join).
Expand and tidy as appropriate.
HotChilli
7 years agoCommunity Champion
Duplicate the query.
In one, unpivot the Sales columns and remove the cost columns.
In the other, unpivot the Costs and remove the sales columns.
In each query, alter the data so you have Year in a column by itself
'Merge as New' the two queries on Year and Division (Inner Join).
Expand and tidy as appropriate.
Anonymous
7 years agoNot applicable
This worked out! Thank you for your time & effort to look into this! I appreciate your help!