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: 
Not applicable

Help to display distinct record based on custcode.

Hi All,

Please help me to display the records based on cust code.

  

CustidTimestampStatidCustcodeCustreason
16/13/2016 10:09:497905Atrigger
16/13/2016 10:09:497905Mtrigger
27/15/2016 23:07:246304Atrigger
27/15/2016 23:07:246304Mtrigger

Expected out put:

  

CustidTimestampStatidCustcodeCustreason
16/13/2016 10:09:497905Mtrigger
27/15/2016 23:07:246304Mtrigger

Thanks in advance.

5 Replies
sunny_talwar

May be just this:

LOAD Custid,

          Timestamp,

          Statid,

          Custcode

          Custreason

FROM ....

Where Custcode = 'M';

Not applicable
Author

Thanks for reply sunny. I missed one scenario.

Please find below.

my data

     

CustidTimestampStatidCustcodeCustreason
16/13/2016 10:09:497905Atrigger
16/13/2016 10:09:497905Mtrigger
27/15/2016 23:07:246304Atrigger
27/15/2016 23:07:246304Mtrigger
36/20/2016 18:08:365102Atrigger

     

Expected Output
CustidTimestampStatidCustcodeCustreason
16/13/2016 10:09:497905Mtrigger
27/15/2016 23:07:246304Mtrigger
36/20/2016 18:08:365102Atrigger

Please advice.

Thanks,

sunny_talwar

May be like this:

Table:

LOAD Custid,

          Timestamp,

          Statid,

          Custcode

          Custreason

FROM ....;



Left Join (Table)

LOAD Custid,

          Count(Custid) as Count

Resident Table

Group By Custid;


FinalTable:

NoConcatenate

LOAD *

Resident Table

Where Count = 1 or Custcode = 'M';

DROP Table Table;

sunny_talwar

Sample attached

Table:

LOAD * INLINE [

    Custid, Timestamp, Statid, Custcode, Custreason

    1, 6/13/2016 10:09:49, 7905, A, trigger

    1, 6/13/2016 10:09:49, 7905, M, trigger

    2, 7/15/2016 23:07:24, 6304, A, trigger

    2, 7/15/2016 23:07:24, 6304, M, trigger

    3, 6/20/2016 18:08:36, 5102, A, trigger

];

Left Join (Table)

LOAD Custid,

          Count(Custid) as Count

Resident Table

Group By Custid;

FinalTable:

NoConcatenate

LOAD *

Resident Table

Where Count = 1 or Custcode = 'M';

DROP Table Table;

Capture.PNG

Not applicable
Author

Thank you sunny. I will try in my original application and let you know the update.