[英]Calculating Weekly Average by user given daily data input in excel pivot table
So I started using Pivot Tables a few weeks ago, but I'm pretty decent at Excel otherwise. 因此,几周前我开始使用数据透视表,但除此之外,我在Excel方面相当不错。 I hit an issue that should be an easy fix and I don't see it.
我遇到了一个应该很容易解决的问题,但我没有看到。 I have a document that is tracking Key Performance Indicators for my warehouse packing department.
我有一个文档正在跟踪我的仓库包装部门的关键绩效指标。 I have 2 tabs in the document that matter (Input Log, and Analysis).
我在文档中有2个重要的选项卡(“输入日志”和“分析”)。
Input log is basically copied from a report generated from my warehouse system. 输入日志基本上是从我的仓库系统生成的报告中复制的。 Gives me a USER, DATE, HRS WORKED, ORDERS PACKED, ITEMS PACKED.
给我一个用户,日期,HRS工作,订单已打包,项目已打包。 Using a pivot table I want to see the average hours worked by week for each user.
我想使用数据透视表查看每个用户每周的平均工作时间。
Currently I can only see the Sum of the hours works and the daily average. 目前,我只能看到工时总数和每日平均值。 How do I also see the weekly average?
我如何查看每周平均值?
[InputLogData][2] [InputLogData] [2]
I was able to get the workbook hosted on google drive Packing KPI Workbook 我能够将工作簿托管在Google Drive Packing KPI工作簿上
If you create the pivot table, but select to "add to data model", 如果您创建数据透视表,但选择“添加到数据模型”,
you will see, in the "Value Fields Settings" selection, a Distinct Count item. 您将在“值字段设置”选择中看到“非重复计数”项。
You can then do a Distinct Count of the WE column, and add a column to divide the total hours worked by User, by the total number of Weeks. 然后,您可以对WE列进行“非重复计数”,并添加一列以将User的总工作时间除以Weeks的总数。 (See the formula in
D4: =B4/C4
) (请参阅
D4: =B4/C4
的公式D4: =B4/C4
)
EDIT : If you want to have the results within the Pivot Table itself, you can add a few calculated columns to your input log. 编辑 :如果要在数据透视表中包含结果,则可以将一些计算列添加到输入日志中。
WE per User
is the Unique number of weeks each user works. WE per User
是每个用户工作的唯一周数。 This formula is an array formula and must be entered by holding down ctrl
+ shift
while hitting enter
. 该公式是一个数组公式,必须在按下
enter
同时按住ctrl
+ shift
来enter
。 Excel will place braces {...}
around the formula seen in the formula bar: Excel将在括号中的公式周围放置括号
{...}
:
=SUM(--(FREQUENCY(IF(User=D2,WE),WE)>0))
Hrs Worked This Wk
is the hours worked in the week by the user. Hrs Worked This Wk
是用户每周工作的小时数。 This is not really needed, but is in there for when I was troubleshooting the calculations. 这并不是真正需要的,但是在我对计算进行故障排除时就可以使用。
=SUMIFS(Hrs_Worked,WE,A2,User,D2)
This will be used to calculate the average for the AvgHrs/Wk
column: 这将用于计算
AvgHrs/Wk
列的平均值:
=SUMPRODUCT((User='Input Log'!$D2)*Hrs_Worked/WE_Per_User)
This can then be used to create the Pivot Table: 然后可以使用它来创建数据透视表:
In the Pivot Table, the 在数据透视表中,
Total Hrs
is the SUM
of Hrs Worked
Total Hrs
是SUM
的Hrs Worked
Hrs-Daily
is the Average
of Hrs Worked, Hrs-Daily
Hrs是工作Hrs的Average
, Weekly Hrs
is the Average
of AvgHrs/Wk Weekly Hrs
是AvgHrs / Wk的Average
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.