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 :

Data

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

So our desired output is :

Output

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)

Calc1

 

Now bring the country in the rows pane.

Double click on the Distinct Count Field.

Calc2

 

Other Calculation that can be created are :

COUNT([State])

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

Calc3

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

 

Thanks
Rahul Singh

Please follow and like us: