Loading
Salesforce now sends email only from verified domains. Read More

Getting Distinct Count When COUNTD Is Not Available

Publish Date: Apr 29, 2025
Task
How to get the distinct count for a field when COUNTD is not available.
Steps

Step 1: Create a WINDOW_SUM Calculation

  1. In Tableau Desktop, connect to Superstore sample data.
  2. Select Analysis > Create Calculated Field.
  3. In the Calculated Field dialog box that opens, enter a name for the field. The COUNTD Alternative example workbook uses Distinct Customers.
  4. In the formula field, type the following, and then click OK:
    WINDOW_SUM(MIN(1))
  5. Drag Distinct Customers from Measures to Columns.
  6. Drag the dimension for which you want the distinct count from Dimensions to Detail. The example workbook uses Customer Name
  7. Right-click Distinct Customers on Columns, and then select Compute Using > Customer Name.

Step 2: Filter on Index

  1. Select Analysis > Create Calculated Field to create another calculated field.
  2. In the Calculated Field dialog box, type a name for the field. The example workbook uses Table Calc Filter.
  3. In the formula field, type the following, and then click OK:
    INDEX()=1
  4. Drag Table Calc Filter from Measures to Filters, and then click OK (do not tick any available option).
  5. Drag Product Category from Dimensions to Rows.
  6. Right-click Table Calc Filter on Filters, select Compute Using > Customer Name, select True, and then click OK.
Additional Resources
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: 
Knowledge Article Number

001467017

Attachments

COUNTD Alternative.twbx

346 KB

 
Loading
Salesforce Help | Article