Max Payne
Max Payne

Reputation: 389

Dynamically determine and categorize duplicates in Tableau

I have a set that has the following structure:

ID | Date | DollarAmount
 1 | Jan  |    50
 1 | Jan  |    20
 2 | Jan  |    10
 1 | Feb  |    20
 2 | Feb  |    10

I am trying to dynamically be able to determine if for a particular period in time there is a duplicate based on the ID column.

For example, based on the data above, I would ideally have

enter image description here

I have tried to filter based on Number of Records but it shows filters out based on the TOTAL observations across the dataset, not date ranges.

Any help is much appreciated Thanks!

Upvotes: 1

Views: 327

Answers (1)

Alex Blakemore
Alex Blakemore

Reputation: 11896

Apparently you define a duplicate records as those that have the same value for the ID and Date fields, where Date is really a string containing the abbreviation for the month name.

In that case, define a (Boolean valued) LOD calculated field called [Duplicates] as {FIXED [ID], [Date] : Count(1) > 1}

Place [Duplicates] on the color shelf, Sum([Dollar Amount]) on rows and [Date] on Columns.

You will see the values True and False on the Color Legend. You can edit the aliases for those values if you want to display a more clear label such Duplicates, Non-Duplicates

If you have a true date valued field instead of a string, you may want to use DateTrunc() to define your duplicate test at the level of granularity that matches your problem.

Upvotes: 1

Related Questions