How to Get the Repeated Behavior in a Dataset

Published: 08 Jun 2021
Last Modified Date: 15 Jun 2021


How to measure the repeated behavior in a Dataset. 
For example, how to get the customer name that has the second purchase behavior and calculate the repeat purchase numbers.


  • Tableau Desktop


The steps are as follows:
  1. Get the first purchase for each customer
    • Field name: 1. First Purchase Date
    • { FIXED [Customer Name]: MIN([Order Date])}
  2. Get the Repeated Purchase Date
    • Field name: Repeated Purchase Date
    • IIF([Order Date] > [1. First Purchase Date], [Order Date],NULL)
  3. Make calculation to decide which customer has repeated purchase behavior
    • Field name: 3. Repeated OR NOT
    • IF { FIXED [Customer Name]:MIN(IF [Order Date] > [1. First Purchase Date] THEN [Order Date] END)}>[1. First Purchase Date]
      THEN "Repeated"
      ELSE "Not Repeated"
  4. Make calculation to get the repeated 
    • Field name: 4. Repeated Number
    • IF ATTR([3. Repeated OR NOT] = "Repeated") 
      THEN COUNT([Order ID]) - COUNT(IIF([Order Date]=[1. First Purchase Date],[Order ID],NULL))
Please check the attached workbook for details.
User-added image
Did this article resolve the issue?