Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Grouping customers by date last ordered

Hi

I need to group customers in to 'buckets' depending on the
last time they purchased.

 

This needs calculate from the max order date - when 0 selections are made,
or filter by the max date when an item or geographical location is selected.

 

Originally I had tried to write this into the script, but I can only get it
to work for the max order date over all.

 

Would this be better calculated with in the chart?

 

I need to display results in a bar chart.

 

see example below;

1 Solution

Accepted Solutions
MarcoWedel

Hi,

one solution could be (at front end):

QlikCommunity_Thread_136024_Pic2.JPG.jpg

QlikCommunity_Thread_136024_Pic4.JPG.jpg

QlikCommunity_Thread_136024_Pic1.JPG.jpg

QlikCommunity_Thread_136024_Pic3.JPG.jpg

hope this helps

regards

Marco

View solution in original post

6 Replies
anbu1984
Master III
Master III

Use class function to create buckets in chart

http://community.qlik.com/blogs/qlikviewdesignblog/2014/07/14/buckets

MarcoWedel

Hi,

one solution could be (at front end):

QlikCommunity_Thread_136024_Pic2.JPG.jpg

QlikCommunity_Thread_136024_Pic4.JPG.jpg

QlikCommunity_Thread_136024_Pic1.JPG.jpg

QlikCommunity_Thread_136024_Pic3.JPG.jpg

hope this helps

regards

Marco

Not applicable
Author

Hi Marco

Thank you for this its working really well.

I just have one more question - i'm stuggling to put this expression into an if statement so that customers with 0 value, or 0 orders are not included.  - can you advise?

Thanks again

Heather

anbu1984
Master III
Master III

=If( Aggr(Div(Today()-Max([order date]),7), customer) > 0,

     Dual (...)

)

Select "Suppress when value is null"

Not applicable
Author

Thank you this have solved my issue!

Not applicable
Author

i've reverted back to the orignal expression

Dual(Replace(Class(Aggr(Div(Today()-Max(Date),7),Customerr),4),'<= x <','-'),

Class(Aggr(Div(Today()-Max(Date),7),Customer),4))

so that I can include customers that have ordered less than a week ago, however this is causeing me an issue with the bucket labels.


Because '0' now takes up positiion 1 as it were, bucket 0-4 only contains the count of customers that ordred in 0-3 weeks. customers that ordered 4 weeks ago now sit in the 4-8 bucket, which containts customers that ordered between 4 and 7 weeks ago and customer that ordered 8 weeks ago sit in bucket 8-12....and so on.

How can I re-lable the buckets to reflect what's actually in them?