计算在power bi中所有字段中具有特定值的用户数量

时间:2019-09-23 20:57:17

标签: powerbi dax powerbi-desktop

我是Power BI的初学者。所以,请问这是一个基本问题。

我有这样的数据:

User1 - Task A - Complete
User1 - Task B - InComplete
User1 - Task C - Complete
User 2 - Task A - Complete
User 2 - Task B - Complete
User 2 - Task C - Complete

现在,我想获得列表中已经完成Power BI中所有任务的不同用户的数量。因此,对于上面的示例,只有一个用户(User2)完成了所有三个任务。我有7个这样的任务,并且有成千上万的用户,如何获得完成所有任务(例如DAX公式)的不同用户的数量。

1 个答案:

答案 0 :(得分:0)

Users with 7 complete tasks =
COUNROWS ( // This counts rows in a table.
  FILTER ( // Filter takes a table and a predicate. It returns only rows that match the
           // predicate.
    VALUES ( 'Table'[User] ), // list of unique users in context
    // Below, we calculate the rows for the current user where 'Table'[Status] is
    // complete. I'm making an assumption on column names. The count will be 7
    // iff the user has 7 rows with 'Table'[Status]="Complete".
    CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Status] = "Complete" ) = 7
  )
)

COUNTROWS将为特定用户返回1或空白。它将返回满足7个完整任务标准的用户总数。