简体   繁体   English

Excel Pivot 表按月计算的总人数的总平均值而不是总人数

[英]Excel Pivot table Grand Average instead of Grand Total for sum of head count by month

i'm sure someone figured a workaround for this as there seems to lots of people with the same question...我敢肯定有人想出了一个解决方法,因为似乎有很多人有同样的问题......

i need a pivot table that calculated total headcount sum each month, but need to have a column for average headcount between the months selected (on the pivot table)我需要一个 pivot 表来计算每个月的总人数总和,但需要有一列用于选择月份之间的平均人数(在 pivot 表上)

in other words, i will have a timeline slicer tied to the pivot table and want to have the average for the range of months selected for the pivot.换句话说,我将有一个与 pivot 表相关联的时间线切片器,并希望为 pivot 选择月份范围的平均值。

i found a thread mentioning using power pivot and adding a column of total count, but havent found the solution i'm looking for...我发现一个线程提到使用电源 pivot 并添加一列总计数,但还没有找到我正在寻找的解决方案......

as shown in the snip of pivot table below, i need the "Grand Total" to show average (or a way to have average in the pivot table...如下面 pivot 表的片段所示,我需要“总计”来显示平均值(或在 pivot 表中获得平均值的方法......

eg count in sept of 56 and count in Oct of 59 should have a Grand Average of 57.5... instead of the total of 115...例如 56 年 9 月的计数和 59 年 10 月的计数应该有 57.5 的总平均数......而不是总数 115......

在此处输入图像描述

EDIT 1:编辑1:

i like where this is going but can't seem to get it working.我喜欢它的发展方向,但似乎无法让它发挥作用。 i have the following written and my measure:我有以下书面和我的措施:

MyMeasure:= VAR T1 = SUMMARIZE(HC_Data, [data date (Month)], "Total Value", SUM(HC_Data[HC count]) RETURN IF( HASONEVALUE(HC_Data [data date (Month)]), SUM( HC_Data[HC count]), AVERAGEX( T1, [Total Value] ) ) MyMeasure:= VAR T1 = SUMMARIZE(HC_Data, [数据日期 (月)], "总值", SUM(HC_Data[HC 计数]) RETURN IF( HASONEVALUE(HC_Data [数据日期 (月)]), SUM( HC_Data[ HC 计数]), AVERAGEX(T1, [总值]))

and get a DAX sintax error并得到一个 DAX sintax 错误

Try the following measure in Power Pivot:在 Power Pivot 中尝试以下措施:

MyMeasure :=
VAR T1 =
    SUMMARIZE( Table1, [Date (Month)], "Total Value", SUM( Table1[Value] ) )
RETURN
    IF(
        HASONEVALUE( Table1[Date (Month)] ),
        SUM( Table1[Value] ),
        AVERAGEX( T1, [Total Value] )
    )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM