Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

No orders in last 4 weeks

Hi *,

I have a salestable with these fields:

customer_id,
.......

order_date,
sales_amount

I'm trying to show (in a table chart) the customers where the last order is "older" (max(order_date)?) than 4 weeks. in these list customers with the last order older than two years shouldn't be shown. Can someone help me how to set this up? Thanks in advance.

Aloah

3 Replies
prieper
Master II
Master II

You may solve this in a calculated dimension like

IF(MAX(Order_Date) < Today() - 720, Null(), IF(MAX(Order_Date) < Today() - 28, 'No Order since 28 days', 'Active Customer'))

You only need then to tickmark "Suppress when value is Null" in the dimension.

HTH
Peter

Anonymous
Not applicable
Author

Aloah,

First, it is convenient to have "customer last order" date. You can add it to your salestable:

JOIN (salestable) LOAD
customer_id,
max(order_date) as customer_last_order_date
RESIDENT salestable
GROUP BY customer_id;

Second, you can use calculated dimension, maybe like this
if(customer_last_order_date<=<criteria>,customer_id)
and use "suppress is value is null" for this dimension.

I'm not sure what is the "criteria" in your case. If it is last four weeks, it is:
today()-28
If it is last 2 years:
addmonths(today(),-24)

Not applicable
Author

Thanks for your help. This helps a lot. Great.