- Bernard K
Computing Days Lapsed Since Last Purchase
Updated: May 18, 2021
Days lapsed since last purchase help organizations understand their customers based on last purchase - enabling marketing teams design campaigns and strategies to recover both dormant and even churned customers.
In this post, I'll use Superstores data-set to show you how to calculate days lapsed since last customer purchase.
Step 1: Find the latest business day.
Using this formula, Tableau will return the maximum date in your whole data set (which is the latest business day).
Step 2: Compute the last purchase date for each customer.
This is simply the maximum Order Date for each customer which is computed as follows;
Step 3: Compute days lapsed using these two dates.
Using the date diff function, you can compute days lapsed after last purchase for each customer as follows;
Executing this will return the days lapsed after last purchase for each customer.
What about computing the previous purchase before last purchase??!!!!
Such date can be computed as follows;
Step 4: Write a calculation that returns all dates before the last purchase as follows;
(This calculation returns all previous purchase dates)
From this field, we can now compute the maximum purchase date for each customer which is essentially the previous purchase date, as follows.
(This calculation can be helpful when interested to know the time elapsed between the last purchase and previous purchase).
I hope this post was helpful to you.
To receive more of the Tableau tips and tricks, kindly subscribe to our mailing list below.
Thank you for reading.