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: 
Purushothaman
Partner - Creator III
Partner - Creator III

Join with Distinct Column - Backend Script

Hi Experts,

Below is my Table:

Purushothaman_3-1674097782048.png

My Requirement is:

I need to get the distinct PartyID as a additional column in the same table where AccountStatus = A . 

Expected Output:

Purushothaman_4-1674097838731.png

 

I have the attached the same. Anyone Please help!!

Thank you,

 

 

 

2 Solutions

Accepted Solutions
Digvijay_Singh

Pl check if something like this is needed - 

input:
LOAD
ACCID,
PARTYID,
AccountStatus,
ACOpendate
FROM [lib://Download/1901_Req.xlsx]
(ooxml, embedded labels, table is Raw)
;


NoConcatenate
final:
Load *,
If(Previous(PARTYID)=Null() OR PARTYID <> Previous(PARTYID),If(AccountStatus='A',PARTYID,null())) as PARTYID2
resident input
order by PARTYID
;

drop table input;

View solution in original post

Purushothaman
Partner - Creator III
Partner - Creator III
Author

DATA:
LOAD
ACCID,
PARTYID,
AccountStatus,
ACOpenDate
FROM
[C:\Users\VIVEK\Documents\Guru\Data.xlsx]
(ooxml, embedded labels, table is Sheet1);

NOCONCATENATE

Main:
LOAD
ACCID,
PARTYID,
AccountStatus,
ACOpenDate,
IF(MATCH(AccountStatus,'A','B'),
IF(MATCH(PARTYID,PEEK(PARTYID)),NULL(),PARTYID)) AS DISTINCT_PARTYID
RESIDENT DATA
ORDER BY PARTYID;

DROP TABLE DATA;

View solution in original post

2 Replies
Digvijay_Singh

Pl check if something like this is needed - 

input:
LOAD
ACCID,
PARTYID,
AccountStatus,
ACOpendate
FROM [lib://Download/1901_Req.xlsx]
(ooxml, embedded labels, table is Raw)
;


NoConcatenate
final:
Load *,
If(Previous(PARTYID)=Null() OR PARTYID <> Previous(PARTYID),If(AccountStatus='A',PARTYID,null())) as PARTYID2
resident input
order by PARTYID
;

drop table input;

Purushothaman
Partner - Creator III
Partner - Creator III
Author

DATA:
LOAD
ACCID,
PARTYID,
AccountStatus,
ACOpenDate
FROM
[C:\Users\VIVEK\Documents\Guru\Data.xlsx]
(ooxml, embedded labels, table is Sheet1);

NOCONCATENATE

Main:
LOAD
ACCID,
PARTYID,
AccountStatus,
ACOpenDate,
IF(MATCH(AccountStatus,'A','B'),
IF(MATCH(PARTYID,PEEK(PARTYID)),NULL(),PARTYID)) AS DISTINCT_PARTYID
RESIDENT DATA
ORDER BY PARTYID;

DROP TABLE DATA;