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

Calculate how often customers trade with each other

Hi all,

I have a trades table like this:

 

TradeIDCustomer
1A
1B
2A
2C
3A
3C
3C

The table shows which customers participated in each TradeID. I want to calculate how often each customer trades with each other. In this example, A has traded with B once, and with C twice. How can I build a table summarizing this for each customer? e.g.

   

First customerSecond customerCount
AB1
AC2
BA1
BC0
CA2
CB0

Is this possible? Does this need to be done in script?

1 Solution

Accepted Solutions
sunny_talwar

This?

Capture.PNG

Script:

Table:

LOAD Distinct *;

LOAD * INLINE [

    TradeID, Customer

    1, A

    1, B

    2, A

    2, C

    3, A

    3, C

    3, C

];

TableCopy:

LOAD DISTINCT TradeID,

  Customer as TradeCustomer

Resident Table;

View solution in original post

1 Reply
sunny_talwar

This?

Capture.PNG

Script:

Table:

LOAD Distinct *;

LOAD * INLINE [

    TradeID, Customer

    1, A

    1, B

    2, A

    2, C

    3, A

    3, C

    3, C

];

TableCopy:

LOAD DISTINCT TradeID,

  Customer as TradeCustomer

Resident Table;