Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Customer purchase behavior

Hi

I have the following data:

    

DateOrder IDCustomer NameProduct sub-category
1/1/20151AComputer
1/1/20151AFurniture
1/1/20151AKitchenware
11/1/20152CComputer
12/1/20153BFurniture
12/1/20153BKitchenware
2/2/20154AComputer
3/2/20155BComputer
4/2/20156BFurniture
4/2/20156BKitchenware
6/2/20157CKitchenware

I am trying to produce a chart like this in Qlikview:

Capture.PNG

I have no idea how to do it. Can anyone help? I hope that the expressions and dimensions would be dynamic (not hard coded in load script), but if not possible, do advise how it can be done via scripting too.

Do note that only customer B has a 3rd purchase, and hence, the average should not be based on 3 different customers.

Thanks!

1 Solution

Accepted Solutions
MarcoWedel

Hi,

another solution might be:

QlikCommunity_Thread_198962_Pic1.JPG

QlikCommunity_Thread_198962_Pic2.JPG

QlikCommunity_Thread_198962_Pic3.JPG

tabOrders:

LOAD Date,

     [Order ID],

     [Customer Name],

     [Product sub-category],

     AutoNumber([Order ID],[Customer Name]) as PurchaseNo

FROM [https://community.qlik.com/thread/198962] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco

View solution in original post

7 Replies
swuehl
MVP
MVP

Maybe like this:

Create a bar chart with no dimension and three expressions:

=Avg( Aggr( If(rowno()=1, Count(Distinct [Product sub-category])), [Customer Name], [Order ID]))

=Avg( Aggr( If(rowno()=2, Count(Distinct [Product sub-category])), [Customer Name], [Order ID]))

=Avg( Aggr( If(rowno()=3, Count(Distinct [Product sub-category])), [Customer Name], [Order ID]))

This approach requires that Order ID shows a load order correctly sorted by purchase date (like in your sample table).

Not applicable
Author

Hi,

Sorry, I realised my data is not arranged so nicely. Its more of like the following:

   

DateOrder IDCustomer NameProduct sub-category
1/1/20151AComputer
1/1/20151AFurniture
1/1/20151AKitchenware
1/1/20152CComputer
12/1/20153BFurniture
12/1/20154AKitchenware
2/2/20155AComputer
3/2/20156BComputer
4/2/20157BFurniture
4/2/20157BKitchenware
6/2/20158CKitchenware

I would like to eventually produce a bar chart of:

  • x axis: Customer Name
  • y axis: No. of purchases required or No. of days required

The bar chart should be sensitive to the filters of the list boxes:

  • Month
  • No. of different sub categories purchased

I have a feeling the data needs to be sorted out as shown below, but don't know how to.

Customer NameNo. of different product sub categories purchasedNo. of purchases requiredNo. of days required
A200
A311
B2222
B3323
C2236
C300
MarcoWedel

Hi,

another solution might be:

QlikCommunity_Thread_198962_Pic1.JPG

QlikCommunity_Thread_198962_Pic2.JPG

QlikCommunity_Thread_198962_Pic3.JPG

tabOrders:

LOAD Date,

     [Order ID],

     [Customer Name],

     [Product sub-category],

     AutoNumber([Order ID],[Customer Name]) as PurchaseNo

FROM [https://community.qlik.com/thread/198962] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco

swuehl
MVP
MVP

How have you calculated columns 2-4 in the 'sorted out' table, from your input table?

MarcoWedel

please close your thread if your original question is answered and open another one for this new question.

thanks

regards

Marco

Not applicable
Author

Thanks Marco and Swuehl!

MarcoWedel

You're welcome.

Did you get your expected result?

If so, please close this thread.

thanks

regards

Marco