Power BI Count 重复 ID 数 [英] Power BI Count number of repeating ID

查看:212
本文介绍了Power BI Count 重复 ID 数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何计算重复 ID?我想把它放在新的列上,如果总数是重复的例子真的没关系(如果结果是这样更好):

How do I count repeating ID? I want to put it on the new column, it really doesn't matter if the number of total is repeating example like (if out come is this then better):

==========|=
   10327  |2
   10327  |2
   10328  |3
   10328  |3
   10328  |3

推荐答案

使用这样的计算列:

NrOfOccurrences = CALCULATE(
    COUNT([OrderID]); 
    FILTER(Orders; [OrderID] = EARLIER('Orders'[OrderID])))

从下到上:

  • FILTER 为您提供每行一个表,其中所有行都具有相同的 OrderID
  • COUNT 将计算 OrderID 的数量,实际上是行数
  • CALCULATE把它们放在一起,这样就统计了相关FILTER表的行数;
  • FILTER gives you a table per row that has all rows with the same OrderID
  • COUNT would count the number of OrderIDs, effectively the number of rows
  • CALCULATE puts them together, so that the number of rows in the relevant FILTER table is counted;

例如这是手动输入表格的截图:

For example this is a screenshot of a manually entered table:

这篇关于Power BI Count 重复 ID 数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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