多层数据透视以不同方式处理层(SUM,MAX,SUM)

时间:2019-04-29 10:15:38

标签: excel excel-pivot

在我的ODBC Excel文件中,我有一个设置为3层的数据透视表: Bin,StockCode,Date。 并以NoOfDays作为值(每天/股票代码/仓位组合始终为1) 第1层和第3层应该是总计,而第2层应该恢复最大值。这可能吗

这是用于仓库存储的计费目的,它需要进行分层挖掘,但不应将每个代码视为另一个值,而应在特定的仓位中报告所有代码的最大值。

这是一些细节:

Bin StockCode   SaveDate    NoOfDays
10001A  SANK1318    2019-03-10  1
10001A  SANK1320    2019-03-10  1
10001A  SANK1318    2019-03-11  1
10001A  SANK1320    2019-03-11  1
10001A  SANK1318    2019-03-12  1
10001A  SANK1320    2019-03-12  1
10001A  SANK1318    2019-03-13  1
10001A  SANK1320    2019-03-13  1
10001A  SANK1318    2019-03-14  1
10001A  SANK1320    2019-03-14  1
10001A  SANK1318    2019-03-15  1
10001A  SANK1320    2019-03-15  1
10001A  SANK1318    2019-03-16  1
10001A  SANK1320    2019-03-16  1
10001A  SANK1318    2019-03-17  1
10001A  SANK1320    2019-03-17  1
10001A  SANK1318    2019-03-18  1
10001A  SANK1320    2019-03-18  1
10001A  SANK1318    2019-03-19  1
10001A  SANK1320    2019-03-19  1
10001A  SANK1318    2019-03-20  1
10001A  SANK1320    2019-03-20  1
10001A  SANK1318    2019-03-21  1
10001A  SANK1320    2019-03-21  1
10001A  SANK1318    2019-03-22  1
10001A  SANK1320    2019-03-22  1
10001A  SANK1318    2019-03-23  1
10001A  SANK1318    2019-03-24  1
10001A  SANK1318    2019-03-25  1
10001A  SANK1313    2019-03-26  1
10001A  SANK1318    2019-03-26  1
10001A  SANK1313    2019-03-27  1
10001A  SANK1318    2019-03-27  1
10001A  SANK1313    2019-03-28  1
10001A  SANK1318    2019-03-28  1
10001A  SANK1313    2019-03-29  1
10001A  SANK1314    2019-03-29  1
10001A  SANK1318    2019-03-29  1
10001A  SANK1313    2019-03-30  1
10001A  SANK1314    2019-03-30  1
10001A  SANK1318    2019-03-30  1
10001A  SANK1313    2019-03-31  1
10001A  SANK1314    2019-03-31  1
10001A  SANK1318    2019-03-31  1
10001B  SANK1323    2019-03-10  1
10001B  SANK1323    2019-03-11  1
10001B  SANK1323    2019-03-12  1
10001B  SANK1323    2019-03-13  1
10001B  SANK1323    2019-03-14  1
10001B  SANK1323    2019-03-15  1
10001B  SANK1323    2019-03-16  1
10001B  SANK1323    2019-03-17  1
10001B  SANK1323    2019-03-18  1
10001B  SANK1323    2019-03-19  1
10001B  SANK1323    2019-03-20  1
10001B  SANK1323    2019-03-21  1
10001B  SANK1323    2019-03-22  1
10001B  SANK1323    2019-03-23  1
10001B  SANK1323    2019-03-24  1
10001B  SANK1323    2019-03-25  1
10001B  SANK1321    2019-03-26  1
10001B  SANK1323    2019-03-26  1
10001B  SANK1321    2019-03-27  1
10001B  SANK1323    2019-03-27  1
10001B  SANK1321    2019-03-28  1
10001B  SANK1323    2019-03-28  1
10001B  SANK1321    2019-03-29  1
10001B  SANK1323    2019-03-29  1
10001B  SANK1321    2019-03-30  1
10001B  SANK1323    2019-03-30  1
10001B  SANK1321    2019-03-31  1
10001B  SANK1323    2019-03-31  1

下面是当前显示的内容(未扩展到日期级别)

Row Labels  Number Of Days
-10001A         44
  +SANK1313     6
  +SANK1314     3
  +SANK1318     22
  +SANK1320     13
-10001B         28
  +SANK1321     6
  +SANK1323     22

我要求:

the Dates(not shown here) to sum on the Codes tier (i.e. 'SANK1313' should be 6 as per illustration) 
The Codes to Max on the Bin tier(i.e. '10001A' should return 22 and '10001B' should return 22)
the Bins to Sum in the grand total

这里的问题是更改字段值属性会更改所有层的所有值计算

0 个答案:

没有答案