The function count is one of the aggregate functions in Tableau, which returns the number of unique values in a field. There are two different types of the count function. The expression count returns the number of items in a group. The expression countd returns the number of distinct items in a group. Null values are not counted. Countd can not be used, if workbooks exist which were created before Tableau Desktop 8.2 that use Microsoft Excel or text file data sources or workbooks that use the legacy connection and workbooks that use Microsoft Access data sources. Before this function can be used, the users have to extract their data into an extract file.1)
Extracts are saved subsets of a data that can be used to improve performance. With extracting the data you also can take advantage of the Tableau functionality that is not available in the underlying data. By defining filters and limits the total amount of data can be reduced. Extracts can improve the performance. For example for file based datasources such as Access or Excel, a full extract takes advantage of the Tableau data engine. For large data sources and if only a subset of data is needed, a filtered extract can limit the load on the server. Extracted data also can be used offline. 2)
The following example shows how to use a count as well as the countd function and shows the differences between both functions. A simple set of data is given in the Microsoft Excel table below.
First of all, the Microsoft Excel data source has to be connected with Tableau. Then you drag the fruit dimension into the marks area.
By clicking on the arrow you can select measures and then click on Count (Dimension).
5) (count function)
6) (countd function)
When using the count function, the grand total is 5, because this function measures the number of fruits which was sold in the different regions. While using the countd function, the grand total is only 3, because it counts the total number of unique items, which is three in this example (apple, banana and orange).