获取数据透视表中组合的百分比 [英] Get percentage of group total in PivotTable

查看:623
本文介绍了获取数据透视表中组合的百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几千名患者,按年龄分组在一个枢轴表中(0-9,10-19,...)。第一组共有59名患者,其中22人死亡。



如何添加计算字段以显示每组中死亡人数的百分比(例如22/59的37%)?



在值字段设置中有显示值为:%,但这是所有患者的百分比。

解决方案

具有如下布局:





在PT中选择一个单元格,并在数据透视表工具>选项>工具 - 公式,计算字段...中添加名称:例如 PerCent 和公式:选择年龄段最大插入字段确定



然后返回到Σ值以及值字段设置中的PerCent计数... 显示值选择%行



对于某些格式化PT的顶部可能看起来像这样:





I have a few thousands patients, which are grouped by age in a pivot table (from 0-9, 10-19,...). The first group for example has 59 patients in total, of which 22 are dead.

How can I add a Calculated Field to show percentages of dead people within each group total (eg 37% for 22/59)?

In Value Field Settings there is something like "Show Value as: %" but that is percentage of all patients.

解决方案

With a layout such as:

select a cell in the PT and in PivotTable Tools > Options > Tools - Formulas, Calculated Field... add a Name: such as PerCent and for Formula: select Age band Max and Insert Field, OK.

Then return to Σ Values and for Count of PerCent in Value Field Settings... and Show values as select % of row:

With some formatting the top of the PT might look something like this:

.

这篇关于获取数据透视表中组合的百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆