EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

Tableau Count Distinct

Home » Data Science » Data Science Tutorials » Tableau Tutorial » Tableau Count Distinct

tableau count distnict

Introduction to Tableau Count Distinct

Count Distinct is the aggregated function present in the tableau. Distinct stands for the unique value of the dimensions or measures. When we create dimension value for the aggregation then the result of the count distinct is get created into measures of the dataset. A calculated field needs to be created for the Count Distinct function. We created a calculated field by clicking the bottom row present near the dimension value set. All the aggregated functions are available with formula in the tableau. We just need to select dimensions as per our choice. we can count Boolean, string, and numbers also. Count (Distinct) returns the unique value in the field.

Syntax of CounD(expression)

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

CountD([region])

How Does Count Distinct Work in Tableau?

CountD function is used for displaying a distinct or unique value of the dimension. It will count the distinct value of the number of items in a group and will display it. It will ignore NULL values. Tableau creates a temporary new column in the measure section as a result of the dimension because the result of count is number, and measure contains the quantity of the data. It will count the unique instance of the field. Suppose if we have 20,000 records for the 10 different countries then the distinct value of the country will be 10 or 5. It will aggregate distinct value for the record even if a large number of the dataset is present.

Examples of Tableau Count Distinct

Examples of tableau count distinct are given below:

Example #1

1. We have connected to the sample superstore database in tableau and fetched the order table.

Tableau Count Distinct-1.1

2. Go to sheet1 where we will get to see data separated into measures and dimensions. Dimension is qualitative data and dimension is quantities data.

Tableau Count Distinct-1.2

3. The number of records options available in the table which counts no of the total data available to the data source.

Tableau Count Distinct-1.3

4. Create calculated field name CountD and enter formula COUNTD([subcategory]).

5. We can choose any dimension for the COUNTD.

6. Drag sub-category to columns and region to Rows.

7. Drag COUNTD calculated field to the text formatting option.

8. We will get the below image.

9. We can observe in the below image, distinct count for each subcategory of each region is given as one.

Tableau Count Distinct-1.4

1. We can show you the difference between COUNT and COUNTD.

2. We have created COUNT([sub-category]) calculated filed and add it to the Rows.

Popular Course in this category
Tableau Training (4 Courses, 6+ Projects)4 Online Courses | 6 Hands-on Projects | 39+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.5 (5,775 ratings)
Course Price

View Course

Related Courses
Business Intelligence Training (12 Courses, 6+ Projects)Data Visualization Training (15 Courses, 5+ Projects)

3. We can see in the below image average count for accessories for the central region is 183 and the distinct count is 1 because there are the multiple numbers of accessories (item) for the central region and it is counted as 1.

Tableau Count Distinct-1.5

Example #2

1. Drag order table to tableau sheet.

2. Create a Calculated Field CountD(dimension).

3. Drag region dimension to the column, CountD measure created to rows and profit measure to Text filtering option.

Tableau Count Distinct-1.6

4. As per the calculated field we created for the city, we can observe the result for central region CountD is 181 but the actual count was 2323 and the profit is 39,706.

5. We can observe the result for the east region is CountD that is a distinct count is 108 and the profit is 91,523.

6. We can observe the distinct count for each region as the unique count for the regions. We had a distinct count for the city as a string.

unique count for the regions-1.7

Example #3

We will countD for the category dimension for the order date of each city.

  1. Create calculated field CountD(category).
  2. Drag to columns and order date to rows.
  3. Drag CountD to text formatting option.

We can observe that for Aberdeen city for the 2016 year we have distinct count as 1. We have calculated a distinct count for category dimension (category is string value).

Aberdeen city-1.8

Example #4

We are going to calculate the distinct value for the world cup matches the winning team for each country with year database.

  1. We have downloaded the world cup matched database file from Tableau resources website.
  2. We have created CountD for the HomeTeam (winning team) because we want to count Distinct or unique value for the winning team.
  3. Drag Country and Year dimension to rows and CountD to Text formatting option.
  4. We get the Hometeam count for a year with the country.
  5. We get the result as for Argentina for the years 1950 and 2000 as HomeTeam as 13 and 13 is the distinct count for both the year meanwhile actual count is 38. For England’s country, the distinct count is 12 for 2000 and 1950 year.

distinct value-1.9

Conclusion

We have learned about how to calculate distinct or unique of the field or dimension. The key point to remember is calculated field needs to be created at first for the CountD aggregation function. The result is always present in measure because it is a number. It is always helpful for the user when they want to find the distinct value of the large dataset.

Recommended Articles

This is a guide to Tableau Count Distinct. Here we discuss How does Count Distinct works in Tableau along with different examples in detail. You may also look at the following articles to learn more –

  1. How does Aggregate Function Work in Tableau?
  2. Creating Donut Chart in Tableau
  3. Sorting in Tableau in detail with Illustrations
  4. Guide to Window Sum Tableau
  5. Tableau Order of Operations | Examples

Tableau Training (4 Courses, 6+ Projects)

4 Online Courses

6 Hands-on Projects

39+ Hours

Verifiable Certificate of Completion

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Tableau Tutorial
  • Functions
    • Tableau Functions
    • Tableau String Functions
    • Concatenate in Tableau
    • Rank Function in Tableau
    • Tableau Aggregate Functions
    • Tableau Date Functions
    • Window Sum Tableau
    • LOD Expressions in Tableau
    • LOOKUP Function in Tableau
    • Tableau Fixed Function
    • Tableau Count Distinct
    • Tableau Window Functions
  • Basic
    • What is Tableau
    • What is Tableau Dashboard
    • What is Tableau Server
    • Uses of Tableau
    • Tableau Versions
    • Tableau Architecture
    • Is Tableau Free
    • Tableau New Features
    • How To Install Tableau
    • How to Use Tableau?
    • Install Tableau Server
    • Tableau Commands
  • Charts
    • Tableau Charts
    • Tableau Chart Types
    • Donut Chart in Tableau
    • Funnel Chart in Tableau
    • Gantt Chart in Tableau
    • Bubble Chart in Tableau
    • Pareto Chart in Tableau
    • Sankey Chart In Tableau
    • Stacked Bar Chart in Tableau
    • Tableau Bullet Chart
    • Waterfall Chart in Tableau
    • Line Chart in Tableau
    • Heat Map in Tableau
    • Histogram in Tableau
    • CrossTab in Tableau
    • Treemap in Tableau
    • Trend Lines in Tableau
    • Tableau Reference Lines
    • Tableau Dual Axis
    • Legend in Tableau
    • Pie Chart in Tableau
    • Tableau Storyline
  • Statement
    • Tableau IF Statement
    • Case Statement in Tableau
  • Sort/Filters
    • Sorting in Tableau
    • Filters in Tableau
    • Types of Filters in Tableau
    • Tableau Action Filter
    • Context Filter in Tableau
    • Tableau Parameter Filter
    • Adding Filters in Tableau Dashboard
    • Tableau Context Filter
  • Tableau Dashboard
    • Dashboard in Tableau
    • Tableau Dashboard Creation
    • Tableau Dashboard Design
    • Tableau Workbook
  • Advanced
    • Tableau Reporting
    • Tableau Reporting Tool
    • Conditional Formatting in Tableau
    • Data Blending in Tableau
    • Parameters in Tableau
    • Tableau Data Sets
    • Tableau Drill Down
    • Tableau Dynamic Parameters
    • Tableau Table Calculation
    • Tableau Visualization
    • Tableau Joins
    • Pivot in Tableau
    • Data Visualization With Tableau
    • Forecast in Tableau
    • Map Layers in Tableau
    • Group in Tableau
    • Tableau Group by
    • Hierarchy in Tableau
    • Sets in Tableau
    • How to create a Set in Tableau
    • Tableau Order of Operations
    • Tableau User Group
    • Tableau Calculated Field
    • Custom SQL in Tableau
  • Interview Questions
    • Tableau Interview Questions

Related Courses

Tableau Certification Course

Business Intelligence Courses

Data Visualization Courses

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you