In a previous article,  Roger Govier showed us a couple of different ways to get a Unique count with a Pivot Table.

在上一篇文章中,Roger Govier向我们展示了几种不同的方法来通过数据透视表获得唯一计数 。

Create a Pivot of a Pivot Tables results (fast)

创建数据透视表的数据透视(快速)

Add a calculated column to the source data (much slower)

将计算出的列添加到源数据(慢得多)

Now Roger has added another technique that you can use, in Excel 2013 and later. I'll hand things over to Roger, so he can describe the steps.

现在,Roger在Excel 2013及更高版本中添加了另一种可以使用的技术。 我将事情交给罗杰,以便他描述步骤。

添加到数据模型 (Add to Data Model)

With the advances made by Microsoft with Power Pivot, and DAX (Data Expressions) formulae, which are more powerful than the inbuilt Excel functions, there is a way of obtaining a Distinct Count. From Excel 2013 onward, when creating a Pivot Table form any set of data, there is an option to Add this data to Data Model.

随着Microsoft在Power Pivot和DAX(数据表达式)公式方面所取得的进步,它们比内置的Excel函数更强大,因此有一种获取非重复计数的方法。 从Excel 2013开始 , 从数据集创建数据透视表时,可以选择将数据添加到数据模型。

When you select this option, Excel treats the data as being loaded into Power Pivot, as opposed into the older Pivot Table.

选择此选项后,Excel会将数据视为已加载到Power Pivot中,而不是旧数据透视表中。

我的默认选择 (My Default Choice)

Even though you might not want to be combining data from multiple tables and creating relationships between tables, this is now my default choice when I create a Pivot Table.

即使您可能不想合并多个表中的数据并在表之间创建关系,现在这也是我创建数据透视表时的默认选择。

Then, when creating the PT, and dragging an item to the Values area, when you click on Value Field settings, and scroll to the bottom, there is a new measure that has been added called Distinct Count.

然后,在创建PT并将项目拖到“值”区域时,单击“值字段”设置并滚动到底部,将添加一个名为“非重复计数”的新度量。

看到不同的计数 (See a Distinct Count)

Choosing this Measure, as opposed to Count, does indeed give you a unique count as can be seen in the following PT example.

与Count相反,选择此度量确实可以为您提供唯一的计数,如下面的PT示例所示。

For each Salesperson, I allocated Product to the Values area twice, once as Count and once as Distinct Count, and I did the same for Customers.

对于每个销售人员,我将产品两次分配到“值”区域,一次分配为“计数”,一次分配为“非重复计数”,而我对“客户”也执行相同的操作。

NOTE: Distinct Count of Product is a measure you wouldn't need, as it clearly has to be the same as the number of Products sold, 5. It has only been included for illustrative purposes.

注意:“产品的不同数量”是您不需要的度量,因为它显然必须与所售产品的数量相同。5.仅出于说明目的将其包括在内。

项数 (Count of Items)

As you can see the Count of Product is the same as the Count of Customer, which is not at all surprising as it is the count of all of the transactions made by these particular Salespeople.

如您所见,产品数量与客户数量相同,这并不奇怪,因为它是这些特定销售人员进行的所有交易的数量。

(The image is trimmed below, to show Barry's Count of Product and Count of Customer, at a larger font size.)

(下面的图像进行了裁剪,以较大的字体显示Barry的产品数和客户数。)

客户的不同数量 (Distinct Count of Customer)

But, the Distinct Count of Customer shows that even though there were 41, 42 and 27 transactions by the three Salespeople shown, they made those sales to 11, 12 and 13 Unique Customers in each case, showing there have been multiple sales to the same Customer.

但是,“不同客户数量”显示,即使显示的三个销售人员分别进行了41、42和27个交易,但他们在每种情况下都分别向11、12和13个唯一客户进行了销售,表明同一笔交易有多个顾客。

(The image is trimmed below, to show Barry's Count of Customer and Distinct Count of Customer, at a larger font size.)

(下面的图像进行了裁剪,以较大的字体显示Barry的客户数和客户的不同数。)

使用此方法 (Use This Method)

This is a much easier method than those I have shown in earlier articles, so if you have Excel 2013 or 2016, or Office 365, then this is definitely the way to go. So, even if you don't need all of the other advantages of Power Pivot, it is always worth choosing the option to add data to the Data Model for all of the new Pivot Tables that you create.

与我之前的文章中介绍的方法相比,这是一种简单得多的方法,因此,如果您拥有Excel 2013或2016或Office 365,则绝对是一种方法。 因此,即使您不需要Power Pivot的所有其他优点,也始终值得选择为您创建的所有新数据透视表向数据模型添加数据的选项。

Big thanks to Microsoft for introducing this long awaited feature, and for making it so easy for people to use without having to get into learning DAX (although there are many benefits from doing so).

非常感谢Microsoft引入了这一期待已久的功能,并使其易于使用,而无需学习DAX(尽管这样做有很多好处)。

获取样本文件 (Get the Sample File)

Thanks to Roger, for explaining how we can easily get a distinct count now! It's easy to overlook that "Add this data to the Data Model" check box, when creating a pivot table. Or, if you aren't aware of the benefits, you wouldn't bother to check it.

感谢罗杰(Roger),解释了我们现在如何轻松获得独特的计数! 创建数据透视表时,很容易忽略“将数据添加到数据模型”复选框。 或者,如果您不了解好处,则无需费心检查它。

If you'd like to download Roger's sample file, from his earlier tutorial, you can go to my Contextures website. Visit the different ways to get a Unique count page, and go to the Download the sample file section. You can use that data to create a new pivot table, and remember to check the "Add this data to the Data Model" box!

如果您想从Roger的较早教程中下载其示例文件,则可以转到我的Contextures网站。 访问获取“唯一计数”页面的不同方法 ,然后转到“下载示例文件”部分。 您可以使用该数据创建新的数据透视表,并记得选中“将此数据添加到数据模型”框!

python数据透视表计数去除重复_excel透视表计数去重_Excel数据透视表中的唯一计数...相关推荐

  1. sql 单表/多表查询去除重复记录

    sql 单表/多表查询去除重复记录 单表distinct 多表group by group by 必须放在 order by 和 limit之前,不然会报错 ********************* ...

  2. excel透视表计数去重_Excel数据透视表中的唯一计数

    excel透视表计数去重 In a previous article,  Roger Govier showed us a couple of different ways to get a Uniq ...

  3. java 两个数组去重复数据_Java实现数组去除重复数据的方法详解

    本文实例讲述了Java实现数组去除重复数据的方法.分享给大家供大家参考,具体如下: 前一段时间被面试问到:如果一个数组中有重复元素,用什么方法可以去重?一时间会想到用一种方法,但是后来查阅资料后发现, ...

  4. mysql中如何去除重复数据_mysql数据库如何去除重复数据

    mysql数据库去除重复数据的方法:1.查询需要删除的记录,会保留一条记录:2.删除重复记录,只保留一条记录,代码为[delete a from test1 a, (...)as bid from t ...

  5. python list每个重复元素保留一次,python 列表(list)去除重复的元素总结

    方法一: 将list作为set的构造函数构造一个set,然后再将set转换会list就可以 >>> myList = [1, 2, 3, 3, 2, 2, 4, 5, 5] > ...

  6. SQL 多表查询去除重复

    多个表以上的连接查询时容易出现重复的结果,SqlServer 中 有一个函数 可以 解决这个问题 SELECT * FROM (SELECT ROW_NUMBER() OVER (PARTITION ...

  7. oracle去重复合计,如何在excel合并同类项数据并求和(去除重复项)

    本例主要介绍如何在excel中合并同类项数据,也就是去除某字段数据的重复值,然后将对应的数据求和,方法很简单,也很实用,对于经常使用excel的人员,能大量减少工作量提高工作效率. 操作步骤: 1.首 ...

  8. python数据透视表计数去除重复_如何用Python实现数据透视表?解除你对透视表的疑惑!...

    相信接触过Excel的小伙伴都知道,Excel有一个非常强大的功能数据透视表可以自由选择不同字段,用不同的聚合函数进行汇总,并建立交叉表格,用以从不同层面观察数据.这么强大的功能,在Python中怎么 ...

  9. python数据透视表计数去除重复_如何从pandas数据透视表中删除重复值?

    因此,我试图将excel的一组指令复制到python中.问题是我对excel和正在发生的事情知之甚少.在 我有一个数据帧:no. name corrected no. corrected name 0 ...

最新文章

  1. UISegmentControl
  2. php如何查询数据是否存在,PHP判断数据库中的记录是否存在的方法,php数据库_PHP教程...
  3. c 冒泡排序_C语言中选择排序和冒泡排序
  4. C 学习笔记 - 数组
  5. 电脑技巧:微软电脑管家测试版发布,赶快来体验一下吧!
  6. 在只需要一个指定正确的参数的情况下如何防止传入其他干扰的参数
  7. coredata 自动化刷新uitableview数据
  8. matlab实验十ask,matlab实验十ASK调制与解调实验
  9. Window winload.efi 文件丢失解决方法
  10. java大文件下载失败_java文件下载超过4G文件错误
  11. Linux 最小化安装后的主机名与域名的修改
  12. android 添加子view,如何在Android中向ImageView添加子视图
  13. Monkey自动化测试
  14. silk lobe资源公众号_小说免费阅读公众号:恐怖玄幻资源
  15. GraphSense介绍
  16. 基于博客标签的多标签分类器(multi-label classification)
  17. hooper篮球意思_篮球运动员的英文单词怎么写
  18. 教你怎么用迅雷下载LOL
  19. 左移shl、右移shr指令用法
  20. 墨迹天气总显示内部服务器更新,互联网要点:墨迹天气无法更新如何解决方法教程...

热门文章

  1. 我做的泡泡龙小游戏——总结
  2. 文件上传限制类型参考
  3. 无人机通信的国内外研究现状
  4. 蜂鸟入职考试35题答案_饿了么(蜂鸟配送)
  5. optaplanner学习笔记(三)为规划问题建模
  6. Android各国语言和Values文件夹命名规则
  7. 大智慧交易系统测试软件,趋势交易!大智慧测试最佳交易系统
  8. 三个并排居中html,css如何让三个DIV并列在一行中
  9. 数字化转型新型能力体系建设指南
  10. 用百度地图定位公司位置-步骤详解