Search code examples
data-visualizationbusiness-intelligencedata-analysistableau-api

count only if field has one entry in Tableau


I am using tableau and am stuck in making the field of the following code unique.

"COUNTD(
IF NOT(ISNULL([firstBillingDate]))
THEN [msisdn]
ELSE NULL
END
)"

Basically its counting unique msisdn's for all the columns which have firstbillingDate present (NOT NULL).

The problem is that one msisdn has more than one firstBillingDate. I want to count unique msidns which has only ONE firstbillingdate


Solution

  • Instead of using [firstBillingDate] in that calculation, create an LOD calc to only retrieve one date per msisdns.

    {fixed [msisdns] : min([firstBillingDate]}

    You can use max or min. I assumed you'd want min to return the earlier date for any multiple dates per msisdns. Now use this in your original calc.