KNOWLEDGE BASE

## How to Get the Repeated Behavior in a Dataset

Published: 08 Jun 2021

### Question

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.

### Environment

• 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"
END
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))
END
Please check the attached workbook for details.