Professional Documents
Culture Documents
co/tableau-training-for-data-visualization
Solutions
Solution 1:
Step 1: Calculate the first date of purchase using LOD as already discussed.
Step 2: Create a calculated field that has the following logic: If the order date is
equal to the day of first purchase for that customer, flag that row as new,
otherwise flag it as existing.
Step3:
Build the visualization:
1) Bring Day of Order Date to Columns.
2) Bring count distinct of Customer ID to Rows.
3) Bring New or Existing to the Filters shelf and keep "New" only.
4) Right-click on the pill on Rows and select add a Quick Table Calculation >
Running Total.
5) Bring Market to Color.
Solution 2:
Step 1: Calculating the first order date for the Customer.
Step 2: The next step is to return the date of all repeat purchases. This
should return the same value as Order Date, but lists “null” for the first
purchase date and any customer who never had a repeat purchase.
Step 4: Now that we know the first and second purchase dates for each customer,
we can calculate the gap between these dates. Save this calculation and move it
from Measures to Dimensions.
Step 5:
Finally, build the visualization
1. Bring [Quarters to repeat purchase] to Columns.
2. Right-click [Quarters to repeat purchase] on Columns and select Dimension.
3. Right-click [Quarters to repeat purchase] on Columns again and select Discrete.
4. Alias the null values with "lapsed".
5. Bring QUARTER(First Purchase Date) to Rows.
6. Right-click QUARTER(First Purchase Date) on Rows and select Discrete.
7. Bring count distinct of customer ID to Color.