简体   繁体   中英

countif for distinct count in tableau

The following command works in Excel. But I need a distinct Count of Client Id's where we left a message and the client called back in 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

That field will have the Client ID for those clients that satisfy the condition, and NULL otherwise.

  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.

Note, COUNTD() can be expensive computationally on large data sets, but fine on smaller ones. If you hit performance issues, you typically then want to reshape your data. Worry about that only if you need to

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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