top of page

Computing Days Lapsed Since Last Purchase

Writer: Bernard KilonzoBernard Kilonzo
marketing image

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).

tableau calculation

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;

tableau calculation

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;

tableau calculation

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;

tableau calculation

(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.

tableau calculation

(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.

Original.png

We Support You Deliver Business-Focused Solutions That Enable Data-Driven Decision Making.

  • Tableau profile
  • YouTube
  • White LinkedIn Icon
  • Facebook
  • X

QUICK LINKS

CONTACT US

+254 738 307 495

East Gate Mall, Donholm

3rd Floor Suite No. 3i

Nairobi, Kenya

Join our mailing list

bottom of page