Last Modified Date: 09 Dec 2022
Environment
Tableau DesktopAnswer
Step 1: Create a WINDOW_SUM Calculation
- In Tableau Desktop, connect to Superstore sample data.
- Select Analysis > Create Calculated Field.
- In the Calculated Field dialog box that opens, enter a name for the field. The COUNTD Alternative example workbook uses Distinct Customers.
- In the formula field, type the following, and then click OK:
WINDOW_SUM(MIN(1))
- Drag Distinct Customers from Measures to Columns.
- Drag the dimension for which you want the distinct count from Dimensions to Detail. The example workbook uses Customer Name.
- Right-click Distinct Customers on Columns, and then select Compute Using > Customer Name.
Step 2: Filter on Index
- Select Analysis > Create Calculated Field to create another calculated field.
- In the Calculated Field dialog box, type a name for the field. The example workbook uses Table Calc Filter.
- In the formula field, type the following, and then click OK:
INDEX()=1
- Drag Table Calc Filter from Measures to Filters, and then click OK (do not tick any available option).
- Drag Product Category from Dimensions to Rows.
- Right-click Table Calc Filter on Filters, select Compute Using > Customer Name, select True, and then click OK.
Additional Information
Any additional measures in the view will also need to use table calculations such as WINDOW_SUM.If attempting to use COUNTD in a secondary data source when blending, see the following additional workarounds:
- If Tableau Prep cannot be used, see: Getting around Count Distinct in a secondary data source (third party website)
- Creating a primary group: Bring a Field into the Primary Data Source in Tableau Help
Discuss this article... Feedback Forum
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials