4 Replies Latest reply on Jan 15, 2019 8:07 AM by Marie Paturel

Purchase frequency over the last 4 weeks

Hello everyone,

I would like to calculate the purchase frequency of my customers over the last 4 weeks (every week).

I have one row per order, with order date and customer ID.

I manage to calculate:
- Variable 1: the number of orders over the last 4 weeks (with window_count) (in the sheet "Nb Purchase" in my workbook)
- Variable 2: the distinct number of customer over the last 4 weeks (thanks to this thread https://community.tableau.com/thread/234405, because unfortunately there is no window_countd)  (in the sheet "Nb Customer" in my workbook)

Finally, I would like to calculate the frequency = Variable 1 / Variable 2 but this does not work with my current variables (in the sheet "All" in my workbook).

• 1. Re: Purchase frequency over the last 4 weeks

You mean this?

Thanks

Deepak

• 2. Re: Purchase frequency over the last 4 weeks

Hello Deepak,

Thanks for your answer. I am sorry my worksheet "All" is confusing. I would like to have :

the number of purchases over the last 4 weeks / the number of distinct customers over the last 4 weeks

= what is in my worksheet "Nb Purchase" / what is in my worksheet "Nb Customer" :

Thanks,

Marie

• 3. Re: Purchase frequency over the last 4 weeks

Count distinct across moving period is bit tricky.

To achieve this, you need to duplicate data set x 4.

Edit data source => Union.

Now you got this table.

Using "Date2", calculation is straight forward.

Thanks,

Shin

• 4. Re: Purchase frequency over the last 4 weeks

Hello Shin,

it works perfectly, thank you very much !

Marie