Tableau Tips : CountD

Hi All,

In this blog I would like to focus on how we can use countd to create calculated field that can answer our requirements.

Suppose we have data in tableau in the following format :


Now we want to get the count of states which have sales more than 0 .

So our desired output is :


Here 3 against India represents the number of states where the sales were more than 0.

To do this we create a calculated field

Distict Count : COUNTD(IF ZN([Sales]) > 0 THEN [State] END)



Now bring the country in the rows pane.

Double click on the Distinct Count Field.



Other Calculation that can be created are :


([Distinct Count])/([Count])


So this would tell us that out of 5 States in Chile 4 have Sales more than 0 , which in percentage form is 80%.


Rahul Singh

Please follow and like us: