Excel数据透视表在数据透视中使用计数时添加%列
我的数据如下:Excel数据透视表在数据透视中使用计数时添加%列,excel,pivot,percentage,calculated-columns,Excel,Pivot,Percentage,Calculated Columns,我的数据如下: Location Responded ----------------------- US Yes US Yes US UK Yes UK Yes UK Yes Location Total Responded Perc (%) --------------------------------------------- US
Location Responded
-----------------------
US Yes
US Yes
US
UK Yes
UK Yes
UK Yes
Location Total Responded Perc (%)
---------------------------------------------
US 3 2 66%
UK 3 3 100%
我运行了一个数据透视表,我的数据透视显示如下:
Location Total Responded
---------------------------------
US 3 2
UK 3 3
我通过添加一个countoflocation
来获得Total
列,并添加一个countofresponsed
来获得数据透视表中的responsed
列
然后,我尝试添加一个进一步的列,该列将为我提供一个%
,输出如下:
Location Responded
-----------------------
US Yes
US Yes
US
UK Yes
UK Yes
UK Yes
Location Total Responded Perc (%)
---------------------------------------------
US 3 2 66%
UK 3 3 100%
但是,当我添加一个计算字段时(使用函数=responsed/Location
),我会得到一个带有#DIV/0的列代码>
有什么想法吗 使用PowerPivot。将源表添加到数据模型,然后添加以下度量值:
NumberResponded:=CALCULATE (
COUNTROWS('Source Table'),
'Source Table'[Responded] = "Yes"
)
TotalResponded:=CALCULATE (
COUNTROWS('Source Table'),
ALL('Source Table'[Responded])
)
PercentResponded:=DIVIDE (
[NumberResponded],
[NumberTotal]
)
再次将[Responsed]字段添加到值中。然后右键单击新列(响应的计数)并选择[将值显示为/%的]。单击“确定”。这应该能奏效