Combining different fees columns to create PivotTa

2019-01-27 11:13发布

I have a table which records revenue for each product, split into type of revenue: price, fees, tax etc.

source data

To analyze the data I'd like to build a PivotTable to show the revenue breakdown, e.g.:

PivotTable

So to build this PivotTable I need to somehow create an intermediate table of the following format so the PivotTable can be used:

data for pivot table

My question is, how do I create a PivotTable from the original table automatically without manually constructing the second table?

1条回答
来,给爷笑一个
2楼-- · 2019-01-27 12:00

Here are the steps you have to do:

(1) Enter the data.

enter image description here

(2) Go to the Data tab and select From Table/Range.

enter image description here

(3) A new window will open up with the Query Editor. Here you need to go to the Transform tab, select the three columns you wish to unpivot and then click Unpivot Columns.

enter image description here

(4) The result will be the following (shown in the Query Editor)

enter image description here

(5) Now you can Load this data to the sheet using Close & Load To... on the Home tab

enter image description here

(6) Select the option to show the data in a pivot table and indicate where the pivot table should be placed before clicking OK

enter image description here

(7) The final result should look something like this once you have dragged the various field into the respective boxes: product and attribute into rows while values goes into the values box

enter image description here

查看更多
登录 后发表回答