Remove Duplicates in Tableau : Bijay Kumar

Remove Duplicates in Tableau
by: Bijay Kumar
blow post content copied from  SalesForce FAQs
click here to view original post



### Summary of How to Remove Duplicates in Tableau In a recent project involving Tableau, it was discovered that some sales records were duplicated, which led to inaccurate totals in the reports. To address this issue, there are several methods available in Tableau to effectively remove duplicates. Here’s a concise explanation of these methods: 1. **Remove Duplicates from the Data Source:** Edit the original data file (like Excel or Google Sheets) to remove duplicates before importing it into Tableau. This is the simplest method. Use the "Remove Duplicates" feature in Excel to clean your data. 2. **Use Level of Detail (LOD) Expressions:** If you can’t modify the data source, LOD expressions allow you to aggregate data at a specific level to avoid counting duplicates. For instance, you might want to count each customer only once despite multiple transactions. 3. **Use the COUNTD() Function:** This function counts distinct values, helping to avoid duplicates in visualizations. For example, you can display both total and unique counts of customers to differentiate between those who made repeat purchases. 4. **Aggregate Data:** By applying aggregation, you can avoid displaying duplicates in your reports. This method sums data up instead of counting individual transactions, thus providing a clearer picture of total sales. ### Conclusion Overall, a good practice for accurate data analysis in Tableau is to identify and remove duplicates, either at the source or within the application itself. Depending on your access level to the data, you can choose the method that best suits your needs. ### Additional Context Using these methods ensures that your reports reflect true data values, which is crucial for reliable decision-making in business contexts. ### Hashtags for SEO #Tableau #DataVisualization #RemoveDuplicates #SalesData #DataAnalysis #TableauTutorial #Analytics #BusinessIntelligence #DataCleaning #LODExpressions #COUNTD #AggregateData


Recently, while I was creating a report on sales data in Tableau, I noticed that a few records were repeated and being counted multiple times. Due to this, the totals in the reports were also calculated with these duplicate values.

As a solution for this, I came to know that in Tableau, there are various methods through which we can remove duplicates, such as formatting the data source details and using calculated fields.

In this Tableau tutorial, I will explain the various methods to remove duplicates in Tableau.

Remove Duplicate Values in Tableau

In Tableau, there are the following methods through which we can remove duplicate values.

  • Remove Duplicates from the data source in Tableau
  • Use LOD Expression to remove duplicate values in Tableau
  • Use the COUNTD() function for unique counts excluding duplicates
  • Aggregate data to avoid displaying duplicate records

Remove Duplicates from the Data Source in Tableau

In this method, we will edit the records in the data source file, which can be an Excel or Google Sheet. This method is helpful when you want to remove duplicates from data before connecting Tableau to the dataset.

  1. Open the data source file in Excel format.
  2. Select all rows -> Go to Data -> Remove Duplicates icon.
Remove duplicate in Tableau
  1. Select the checkboxes for the Columns from which you want to find and delete the duplicates. After selecting the Columns, click OK.
Remove duplicate values in Tableau
  1. As we click OK, the duplicate records will be removed from the data sheet.
Unique count to remove duplicate values

Now, we can connect and use the data in Tableau for data visualisation.

This way, we can remove the duplicates directly from the data source and use the file later in Tableau.

Use LOD Expression to Remove Duplicate Values in Tableau

If duplicates cannot be removed in the source due to permissions, we can use Level of Detail (LOD) expressions to remove them inside Tableau.

For example, we have multiple transactions per customer, but we want to count each customer only once.

Now, follow the steps below to remove the duplicate in the Tableau data source using the LOD expression.

  1. To create a calculated field, click on the Analysis tab and select Create Calculated Field.
  1. Enter the formula below in the calculated field to count the distinct values (avoiding duplicates).
{ FIXED [Customer ID] : MIN([Customer Name])}
  1. Now, to create the view, add the Customer Name and calculated field to Rows, Order ID and Product to the Text or Label card.
Unique count for removing duplicate values in tableau

In the text table, we can see that each customer will show a unique number of orders, even if there are duplicate Order IDs in the data.

Use the COUNTD() Function for Unique Counts

Another way to avoid duplicate records in the Tableau data visualisation is using the COUNTD() function. This will count only the distinct values and avoid displaying the duplicates.

  1. To create the view, add the Region dimension to the Rows.
  1. Create two formula fields to count the total and the unique count of the customers.
//Total Customers Count
COUNT([Customer ID])

//Unique Customers Count
COUNTD([Customer ID])
  1. Now add both fields on the Columns shelf or side by side on the Text card in the Marks section.

Now, when we hover over the regions in the table, it will show the total customers and the distinct count of customers.

Use Distinct count to avoid duplicated in Tableau

This distinct count shows the number of customers by excluding the count of customers that had repeated purchases.

This way, we can use the COUNTD() function for the distinct count and show the records without duplicate or repeated values.

Aggregate Data to Avoid Displaying Duplicate Records

In this method, we will use the aggregate method to avoid showing duplicate records.

  1. To create the view, add Region and Customer Name to Rows.
  1. After this, add the Sales to Text card in the Marks section. With this, you may notice higher totals because of duplicate orders.
Tableau Find duplicates
  1. Now, click on the Analysis tab and ensure that Aggregate Measures. After this, select Totals -> Show Row Grand Totals.
Tableau Remove duplicates

If you don’t see any change in your totals after enabling “Aggregate Measures“, it means your dataset doesn’t contain exact duplicates in the fields being displayed. In Tableau, Aggregation only affects records that are identical across all grouped dimensions.

This way, we can aggregate the data to avoid displaying duplicate records in Tableau.

Conclusion

In this Tableau tutorial, we have learned how to handle and remove duplicate records in Tableau to ensure accurate data analysis. In the above example, we have learned to remove duplicate data at the source level by using Tableau’s built-in calculation and aggregation methods.

If you can edit the data file, removing duplicates directly in Excel or Google Sheets is the simplest approach. When working with connected datasets or restricted sources, using LOD Expressions, COUNTD(), or Aggregation inside Tableau is a preferable solution.

You may also like to read:

The post Remove Duplicates in Tableau appeared first on SalesForce FAQs.


October 08, 2025 at 11:34PM
Click here for more details...

=============================
The original post is available in SalesForce FAQs by Bijay Kumar
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce