KNOWLEDGE BASE

Distinct Count of an IF Statement is One Higher than Expected


Published: 10 May 2017
Last Modified Date: 12 May 2017

Issue

When calculating COUNTD() of another calculation that is an IF statement with an ELSE "" clause, then the counts are one higher than expected

For example:
COUNTD(
IF [Region] = "Central"
THEN [Customer Name]
ELSE ""
END
)

Environment

Tableau Desktop

Resolution

Replace ELSE "" with ELSE NULL.

Cause

An empty string, written as "", is a distinct text value that will be counted.
Did this article resolve the issue?