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

Market Basket-find associate items not on same orders but on same session

Help!!

I have the sample data like below, I want to do a basket analysis, e.g. when I select an category on an list box(e.g. DL) the graph would show the associate category that is in the same session id, but without invoice id (in terms of no. of time of session)

Session IDInvoiceIDItemIDCategory
36201211

DL

36201212DL
36201213DB
36201214DB
36201215W
3620216Q
3620217Q
3620218E
11112219DL
11112220E
11112221JL
1111222JL
1111223Q
1111224W

for example, when I select DL on a list box,The result should be below, how can I achieve below  with what dimension and expression??? Many Thanks for help.

CategoryNo. of session
Q2
E1
W

1

15 Replies
Not applicable
Author

Sunny,

Because i want to know for each category, how many times it have not been sold with the selected category on the same session..in the sample data above, i assume that i would click category E( have been sold on the session) on a list box , and the chart shows that JL have have not been sold with category E in one session( 1111)....

Not applicable
Author

i am able to find out the category that have been sold together with the selected category with the below expression with the use of invoice ID, however i cannot find those not sold together with the selected item......

 

=count(DISTINCT {$<InvoiceID=P({$}InvoiceID),Category=E({$}Category),Flag = {0}>}InvoiceID

Not applicable
Author

Tried many times, could you kindly help.

sunny_talwar

Not 100% sure, but try this

=Count(DISTINCT{<Category = p({<Category, [Session ID] = p([Session ID]), Flag = {1}>}), Flag = {1}, [Session ID] = p({<Flag = {0}>})>}[Session ID])


Capture.PNG

Not applicable
Author

Thanks so much sunny, this is what i want to acheive.

you saved my day.

sunny_talwar

Super... I am glad you got what you wanted...

Best,

Sunny