Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Profile ID | Status1 | Status2 | CustId |
780 | INPROG | Complt | 100 |
88 | INPROG | Cancel | 200 |
789 | INPROG | Complt | 200 |
800 | INPROG | Cancel | 300 |
The above table has duplicate customer(200) and two unique customers(100 & 300).
For Duplicates customer the Status would be taken as Status1
For Unique customers the Status would be taken as Status2.
Please help me to get the below mentioned result.
Output: | ||
Profile ID | CustId | Status |
780 | 100 | Complt |
88 | 200 | INPROG |
789 | 200 | INPROG |
800 | 300 | Cancel |
s2:
LOAD [Profile ID],
Status1,
Status2,
CustId
FROM
[https://community.qlik.com/thread/196424]
(html, codepage is 1252, embedded labels, table is @1);
Left Join (s2)
load CustId, count(CustId) as Cnt Resident s2 group by CustId;
final:
LOAD
[Profile ID],
if(Cnt>1, Status1, Status2) as Status,
// Status1,
// Status2,
CustId
Resident s2;
DROP Table s2;