根据列中的项目在excel数据透视表中创建计算字段

时间:2022-09-15 20:31:29

Normally calculated pivot table fields in excel (2010) you click: design tab > options and sets > calculated field

通常计算excel(2010)中的数据透视表字段,单击:设计选项卡>选项并设置>计算字段

and if you had three columns: name, sales, cost

如果您有三列:名称,销售,成本

name | sales | cost
josh    10      2    

your calculated field might be: profit which would be: = sales - cost.

您的计算字段可能是:利润,即:=销售 - 成本。

However is it possible to make a calculated field which calculates the difference between two items in the one "Week Ending" column?

但是,是否可以创建一个计算字段来计算一个“周结束”列中两个项目之间的差异?

For example "Week ending" contains a dates which end on a friday 2015-05-01,2015-05-08,2015-05-15 etc and they are in the column labels section of the pivot table.

例如,“周结束”包含截止日期为2015-05-01,2015-05-08,2015-05-15等的日期,它们位于数据透视表的列标签部分。

The "week ending" dates are all in the one column, is it still possible to calculate the difference between two of them with a calculated field?

“周结束”日期都在一列中,是否仍然可以使用计算字段计算其中两个之间的差异?

name | End Fri 2015-05-01 | End Fri 2015-05-08 | calculated (Delta)
josh    8                              10           10-8 = 2

1 个解决方案

#1


You do this with a Calculated Item. Here is an example that I think gets close to what you want. I selected one of the dates in order to get the menu to show up.

您可以使用计算项目执行此操作。这是一个我认为接近你想要的例子。我选择了其中一个日期以便显示菜单。

根据列中的项目在excel数据透视表中创建计算字段

根据列中的项目在excel数据透视表中创建计算字段

Here is the result

这是结果

根据列中的项目在excel数据透视表中创建计算字段

And here is a good reference about these. http://www.contextures.com/excelpivottablecalculateditem.htm

这里有一个很好的参考。 http://www.contextures.com/excelpivottablecalculateditem.htm

#1


You do this with a Calculated Item. Here is an example that I think gets close to what you want. I selected one of the dates in order to get the menu to show up.

您可以使用计算项目执行此操作。这是一个我认为接近你想要的例子。我选择了其中一个日期以便显示菜单。

根据列中的项目在excel数据透视表中创建计算字段

根据列中的项目在excel数据透视表中创建计算字段

Here is the result

这是结果

根据列中的项目在excel数据透视表中创建计算字段

And here is a good reference about these. http://www.contextures.com/excelpivottablecalculateditem.htm

这里有一个很好的参考。 http://www.contextures.com/excelpivottablecalculateditem.htm