Hello! I am working with a dataset that has data in row format.
| Q1 2010 | Q2 2010 | Q3 2010 | Q4 2010 | Q1 2011 | Q2 2011 | Q3 2011 | Q4 2011 | ||
| Total value | Center 1 | 200 | 300 | 150 | 200 | 110 | 60 | 80 | 100 |
| Total value | Center 2 | 120 | 140 | 130 | 92 | 87 | 95 | 90 | 140 |
| Sales | Center 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Income | Center 1 | 10 | 0 | 0 | 12 | 29 | 0 | 30 | 0 |
| Rent | Center 1 | 0 | 13 | 14 | 18 | 0 | 0 | 0 | 23 |
| Sales | Center 2 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 0 |
| Income | Center 2 | 0 | 0 | 0 | 0 | 40 | 0 | 0 | 0 |
| Rent | Center 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
I want to transform this into a column oriented format like below.
| F2 | Name | Total Value | Sales | Income | Rent |
| Center 1 | Q1 2010 | 200 | 0 | 10 | 0 |
| Center 1 | Q2 2010 | 300 | 0 | 0 | 13 |
| Center 1 | Q3 2010 | 150 | 0 | 0 | 14 |
| Center 1 | Q4 2010 | 200 | 0 | 12 | 18 |
| Center 1 | Q1 2011 | 110 | 0 | 29 | 0 |
| Center 1 | Q2 2011 | 60 | 0 | 0 | 0 |
| Center 1 | Q3 2011 | 80 | 0 | 30 | 0 |
| Center 1 | Q4 2011 | 100 | 0 | 0 | 23 |
| Center 2 | Q1 2010 | 120 | 0 | 0 | 0 |
| Center 2 | Q2 2010 | 140 | 0 | 0 | 0 |
| Center 2 | Q3 2010 | 130 | 0 | 0 | 0 |
| Center 2 | Q4 2010 | 92 | 0 | 0 | 0 |
| Center 2 | Q1 2011 | 87 | 0 | 40 | 0 |
| Center 2 | Q2 2011 | 95 | 0 | 0 | 0 |
| Center 2 | Q3 2011 | 90 | 12 | 0 | 0 |
| Center 2 | Q4 2011 | 140 | 0 | 0 | 0 |
I am almost able to achieve this using transpose and cross tab but I am unable to get the quarters in the same sequence. This is what I get as my output.
| F2 | Name | Income | Rent | Sales | Total_value |
| Center 1 | Q1 2010 | 10 | 0 | 0 | 200 |
| Center 1 | Q1 2011 | 29 | 0 | 0 | 110 |
| Center 1 | Q2 2010 | 0 | 13 | 0 | 300 |
| Center 1 | Q2 2011 | 0 | 0 | 0 | 60 |
| Center 1 | Q3 2010 | 0 | 14 | 0 | 150 |
| Center 1 | Q3 2011 | 30 | 0 | 0 | 80 |
| Center 1 | Q4 2010 | 12 | 18 | 0 | 200 |
| Center 1 | Q4 2011 | 0 | 23 | 0 | 100 |
| Center 2 | Q1 2010 | 0 | 0 | 0 | 120 |
| Center 2 | Q1 2011 | 40 | 0 | 0 | 87 |
| Center 2 | Q2 2010 | 0 | 0 | 0 | 140 |
| Center 2 | Q2 2011 | 0 | 0 | 0 | 95 |
| Center 2 | Q3 2010 | 0 | 0 | 0 | 130 |
| Center 2 | Q3 2011 | 0 | 0 | 12 | 90 |
| Center 2 | Q4 2010 | 0 | 0 | 0 | 92 |
| Center 2 | Q4 2011 | 0 | 0 | 0 | 140 |
I want to have the quarters in sequence because I want to forecast some columns. Any help is appreciated.
Solved! Go to Solution.
I think you are mostly there, you just need to sort the data. Since there wasnt a great option to sort the Name coulmn how you wanted it, I made one using the year in each on and added that new column to my sort. A select will easily remove the extra helper column.
