Last Modified Date: 20 Jul 2023
Environment
Tableau DesktopAnswer
The below steps can be reproduced using the attached NextPurchaseDate.twbx workbook. This example is using the Superstore sample data.Step 1: Connect to the Data
- In the Data Source tab, drag and drop the Orders sheet.
- Place the Orders sheet again to next to the existing Orders sheet
- Select Inner Join with using Customer Name = Customer Name (Orders 1).
- Go to Sheet 1 and rename Order Date (Orders 1) to 2nd+ Purchase Date.
Step 2: Create three calculated fields
- Select Analysis > Create calculated field
- Name the calculated field "Not Same Order Date?" and enter the following formula and click OK:
[Order Date]<>[2nd+ Purchase Date]
- Select Analysis > Create calculated field
- Name the calculated field "Later Than First Order Date?" and enter the following formula and click OK:
[Order Date]< [2nd+ Purchase Date]
- Select Analysis > Create calculated field
- Name the calculated field "Next Purchase Date?" and enter the following formula and click OK:
{FIXED [Customer Name],[Order Date]:MIN([2nd+ Purchase Date])}=[2nd+ Purchase Date]
Step 3: Build the view
- Place Customer Name, Order Date and 2nd+ Purchase Date to Rows.
- Place Not Same Order Date? to Filters and select True.
- Place Later Than First Order Date? to Filters and select True.
- Right click Not Same Order Date? on the Filters shelf > Add to context.
- Right click Later Than First Order Date? on the Filters shelf > Add to context.
- Place Next Purchase Date? to Filters and select True.
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials