简体   繁体   English

countif 用于 tableau 中的不同计数

[英]countif for distinct count in tableau

The following command works in Excel.以下命令适用于 Excel。 But I need a distinct Count of Client Id's where we left a message and the client called back in Tableau但是我需要一个不同的客户 ID 计数,我们在其中留下了一条消息,客户在 Tableau 中回电

=COUNTIFS('Sheet2'!C:C,"=Left Message", 'Sheet2'!D:D,"=Spoke to client") 

You didn't described your data set, but assuming it looks like something like您没有描述您的数据集,但假设它看起来像

Client ID | Left Message Date | Client Returned Call Date
333       |  2/2/2021         | NULL
444       |  3/15/2021        | 3/17/2021
555       |  NULL             | NULL

Then something like this should work那么这样的事情应该可以工作

  1. Define a calculated field called [Client ID who returned call] as if [Left Message?] and [Spoke to Client?] then [Client ID] end定义一个名为 [Client ID who returned call] 的计算字段, if [Left Message?] and [Spoke to Client?] then [Client ID] end

That field will have the Client ID for those clients that satisfy the condition, and NULL otherwise.该字段将包含满足条件的客户端的客户端 ID,否则为 NULL。

  1. Then you can place [Client ID who returned call] on any shelf and choose the COUNTD aggregation function to get a count of unique clients that returned messages.然后,您可以将 [返回呼叫的客户 ID] 放在任何货架上并选择 COUNTD 聚合 function 以获取返回消息的唯一客户端的计数。

Note, COUNTD() can be expensive computationally on large data sets, but fine on smaller ones.请注意, COUNTD() 在大型数据集上的计算成本可能很高,但在较小的数据集上却很好。 If you hit performance issues, you typically then want to reshape your data.如果遇到性能问题,您通常会想要重塑数据。 Worry about that only if you need to仅在需要时才担心

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM