7 Replies Latest reply on Apr 26, 2018 3:21 AM by Aymeric DE CREMIERS

# LOD Customer Order Frequency depending on date filter

Hi community,

I've been struggling for weeks to do a chart similar to the Custumer Order Frequency LOD example ( Top 15 Tableau LOD Expressions ) depending on a date filter.

So, based on the following dataset,

• # orders from Customer 1 :
• 1 in january
• 1 in february

• # orders from Customer 2 :
• 2 in january
• 2 in february

• # orders from Customer 3 :
• 1 in january
• 2 in february

We would have, considering the whole period (i.e. January and February)  :

• 1 customer with 2 orders
• 1 customer with 3 orders
• 1 customer with 4 order

But filtering on January only, this would update to:

• 2 customers with 1 order
• 1 customer with 2 orders

Any ideas how to achieve this ?

• ###### 1. Re: LOD Customer Order Frequency depending on date filter

Hi, Aymeric

It will depend on what your data looks like, can you provide a sample data or sample workbook?

ZZ

• ###### 2. Re: LOD Customer Order Frequency depending on date filter

Hi ZZ

Thanks for your help. Please find below a data sample, where each line counts for an order event associated with one customer id.

 order_date customer_id 1/1/18 John 2/15/18 John 1/6/18 Paul 1/7/18 Paul 2/11/18 Paul 2/20/18 Paul 1/10/18 Luke 2/11/18 Luke 2/23/18 Luke
• ###### 3. Re: LOD Customer Order Frequency depending on date filter

Hi, Aymeric

thanks for your sample data, really helpful.

Please find my solution attached as well as screenshot of result below as reference.

Hope this helps and let me know if you have question

ZZ

1 of 1 people found this helpful
• ###### 4. Re: LOD Customer Order Frequency depending on date filter

Well thank you very much ZZ. This looks fine !

However, I can't see how you achieved this cause I've got Tableau 10.5 and your twbx is not readable.

I've tried to reproduce your tableau :

# of orders = { FIXED [Customer Id]:COUNTD([Order Date])} , as a dimension

# of customers = COUNTD([Customer Id])

and a filter on the month (order date)

however, nothing changes when I select different month.

It looks like the secret is in the setting of the filter month (order date).

Would it be possible to describe the settings for this filter ?

THnaks again for your help !!

• ###### 5. Re: LOD Customer Order Frequency depending on date filter

Hi, Aymeric

I think you need add the filter into context as shown below

My workbook is 10.2 version

ZZ

1 of 1 people found this helpful
• ###### 6. Re: LOD Customer Order Frequency depending on date filter

hi ZZ,

I have logic issue plz give me a solution.

SQL and Tableau Logic

Thanks,

Veeru.

• ###### 7. Re: LOD Customer Order Frequency depending on date filter

You nailed it ! Thank you very much for your help ZZ !