KNOWLEDGE BASE

Unexpected Results of New and Repeat Counts in a Tableau View


Published: 17 Nov 2023
Last Modified Date: 17 Nov 2023

Issue

When counting the number of new and repeat customers by date, the results are different from what was expected.

For example, assume that you have the following data.

User-added image

When displaying the number of distinct new and repeat customers by date, one new and one repeat customer are counted on the first purchase date.

User-added image
User-added image

Environment

  • Tableau Desktop

Resolution

Create calculated fields to find the first purchase date and repeat counts. Follow along in the sample packaged workbook found in the Attachments section to count new and repeat customers at the granularity of year, month and day.

User-added image
User-added image

1. Create a calculated field and name it First Purchase Date.
{ FIXED [Customer] : MIN(DATE([Date])) }
2. Create a calculated field and name it New / Repeat.
IF DATE([Date]) = [First Purchase Date] THEN "New"
ELSE "Repeat"
END
3. Create views using the calculated fields above as you need.

Cause

Due to the different granularity of the data, the results can be unexpected.
Did this article resolve the issue?