Give a chestnut! Tableau Tips (87): Implementing Customer Repurchase Analysis with the Fixed Function

published: 2021-05-31

Hello, Ada! I have customer purchase data, I want to count the customer's repeated purchases on a quarterly basis. I want to see the cycle of customer repurchase (how often it will be repurchased), what should I do?

Add one more point: According to the quarterly statistics, if you buy in the first quarter, you must repeat the purchase in the first quarter.

Recently, a Tableau user has proposed the above analysis requirements. In fact, such an application scenario is very common.

In marketing, whether you can capture the number of repeat customers and repeat customers is the specific performance of the product can withstand the test of the market, the analysis of repeat customers will directly affect the company's decision-making.

In fact, we can check the customer's retention status through a customer repurchase analysis (as shown below), reflecting the overall loyalty of the customer.

- The ordinate in the chart is the “first purchase time”, we are here according to the quarterly statistics (in practice, it can also be changed to year, month, day, etc.);

- The abscissa in the chart is "the second purchase time - the first purchase time". If the customer does not have a second purchase (that is, the value of the second purchase time is NULL), the abscissa will appear NULL, it is a Loss status.

- The number in the chart is “the number of customers purchased twice”, and the shade of the color represents the number of customers who buy back.

What about such a customer repurchase analysis? Here, we need to use the Fixed function.

In this issue of "Give a Chestnut", the Tableau technique that Ada wants to share with everyone is: Use the Fixed function to implement customer repurchase analysis.

For the convenience of learning, we use the supermarket data that comes with Tableau.

Specific steps are as follows:

Step 1:create a calculated field

We need to create 4 calculated fields, as follows:

1) First purchase time

{ FIXED [Customer ID] : MIN ([Order Date]) }

2) Date judgment

Iif ([order date] > [first purchase time], [order date], null)

3) Buy time again

{FIXED [Customer ID] : MIN ([date judgment])}

4) Interval - quarter

Datediff('quarter',[first purchase time], [repurchase time])

Step 2:create a chart

Next, drag the Interval-Quarter and First Purchase Time to the columns and rows, right-click the Interval-Quarter column and select the dimension.

Right click on "Interval Time - Quarter" again to select Discrete; right click on "First Purchase Time" to select the second quarter, then select Discrete.

Then, get the following chart:

Then drag the "Customer ID" into the color and text in the tag, then select "Metric > Count (different)" and select the square in the marker box; change the NUll alias to "Drain" and adjust the worksheet.

So, this customer repurchase analysis is completed!

Today's Tableau trick, are you getting it?Open your Tableau and try it out!