Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Basket Cross table

Hi Experts ,

I'm a begginer on QV and I'm looking for a solution about a basket customer analysis like this

I have quantities sold of 4 items (or Item Groups) for several customers (or Cust Groups):

Data set

Sum of qtyItem AItem BItem CItem D
Customer 1504250
Customer 21200400
Customer 3065032
Customer 401040121
Customer 50050130
Customer 60510

and the target result should be a cross table built as sum qty of both items if and only if they are sold together

Cross table

summary of both items sold Item AItem BItem CItem D
Item A0922150
Item B920103228
Item C2151030341
Item D02283410

that is

Item A+B92
Item A+C215
Item A+D0
Item B+C103
Item B+D228
Item C+D341

How can build a matrix like this ?

Thanks in advance

3 Replies
Gysbert_Wassenaar

See attached example


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

A slightly different approach:

TMP:

CROSSTABLE (Item, Value,2) LOAD recno() as ID, * INLINE [

Customer, Item A,    Item B,    Item C,    Item D

Customer 1,    50,    42,    5,    0

Customer 2,    120,    0,    40,    0

Customer 3,    0,    65,    0,    32

Customer 4,    0,    10,    40,    121

Customer 5,    0,    0    ,50    ,130

Customer 6    ,0,    5    ,1,    0

];

BASKET:

NOCONCATENATE LOAD * Resident TMP where Value >0;

LOAD ID, Item as Item2, Value as Value2 Resident TMP where Value >0;

drop table TMP;

Then create a pivot with dimensions Item and Item2 and as expresssion:

=if (Item <> Item2,rangesum(sum(Value),sum(Value2)))

Regards,

Stefan

Not applicable
Author

Thanks a lot

Gysberth & Swuehl

for your suggestions !!!

Regards