Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
johnan
Creator III
Creator III

Two diffrent values to 1 value (compile)

HI, totalt stop in the head.

I got this table with data:

CustSellerID CustBuyerID Amount
4 5 3000
1 7 130
4 3 300
6 4 200



I want to compile the results like this:

Customer Sell Buy
4 3500 200
1 130 0
7 0 130
6 200 0
5 0 3000
3 300 0

 

 

 

Labels (2)
1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like below

Cust:
LOAD * INLINE [
CustSellerID, CustBuyerID, Amount
4, 5, 3000
1, 7, 130
4, 3, 300
6, 4, 200
];

FCust:
LOAD CustSellerID as Customer, Sum(Amount) as Sell Resident Cust Group by CustSellerID;
Join
LOAD CustBuyerID as Customer, Sum(Amount) as Buy Resident Cust Group by CustBuyerID;

DROP Table Cust;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

1 Reply
MayilVahanan

Hi

Try like below

Cust:
LOAD * INLINE [
CustSellerID, CustBuyerID, Amount
4, 5, 3000
1, 7, 130
4, 3, 300
6, 4, 200
];

FCust:
LOAD CustSellerID as Customer, Sum(Amount) as Sell Resident Cust Group by CustSellerID;
Join
LOAD CustBuyerID as Customer, Sum(Amount) as Buy Resident Cust Group by CustBuyerID;

DROP Table Cust;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.