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: 
Varun1
Partner - Contributor III
Partner - Contributor III

Fetch latest records

Hi,

My data currently looks like this.

Case IdentifierCycleStageMax stages in the cycleOverall StatusTime (Days and Hours)SLA Time ScaleSLA.Time
{E075B973-0000-C511-B2FA-0428B188370D}625Pending0 00:20:21Less Than 7 Days12/05/2021 10:06:20 AM
{E075B973-0000-C511-B2FA-0428B188370D}615Pending0Less Than 7 Days12/05/2021 10:05:59 AM
{E075B973-0000-C511-B2FA-0428B188370D}522Complete0 00:15:18Less Than 7 Days21/10/2020 10:21:15 AM
{E075B973-0000-C511-B2FA-0428B188370D}512Pending0Less Than 7 Days21/10/2020 10:05:57 AM
{E075B973-0000-C511-B2FA-0428B188370D}422Complete0 00:07:21Less Than 7 Days20/10/2020 2:58:41 PM
{E075B973-0000-C511-B2FA-0428B188370D}412Pending0Less Than 7 Days20/10/2020 2:51:20 PM
{E075B973-0000-C511-B2FA-0428B188370D}322Complete0 03:22:03Less Than 7 Days20/10/2020 2:37:09 PM
{E075B973-0000-C511-B2FA-0428B188370D}312Pending0Less Than 7 Days20/10/2020 11:15:06 AM
{E075B973-0000-C511-B2FA-0428B188370D}222Complete0 00:46:35Less Than 7 Days05/08/2020 11:28:05 AM
{E075B973-0000-C511-B2FA-0428B188370D}212Pending0Less Than 7 Days05/08/2020 10:41:30 AM
{E075B973-0000-C511-B2FA-0428B188370D}122Complete0 04:24:59Less Than 7 Days04/08/2020 10:38:39 PM
{E075B973-0000-C511-B2FA-0428B188370D}112Pending0Less Than 7 Days

04/08/2020 6:13:40 PM

 

       

 

 

In the data i have multiple case identifiers corresponding to which there are task cycles that get completed only after the Stage number = to the max stages in the cycle.

What i need to do now is to remove the rows where the status is "pending"and keep only the rows with the "Complete" status in the previous cycles i.e. cycles prior to 6 . As shown below.

 

Case IdentifierCycleStageMax stages in the cycleOverall StatusTime (Days and Hours)SLA Time ScaleSLA.Time
{E075B973-0000-C511-B2FA-0428B188370D}625Pending0 00:20:21Less Than 7 Days12/05/2021 10:06:20 AM
{E075B973-0000-C511-B2FA-0428B188370D}615Pending0Less Than 7 Days12/05/2021 10:05:59 AM
{E075B973-0000-C511-B2FA-0428B188370D}522Complete0 00:15:18Less Than 7 Days21/10/2020 10:21:15 AM
{E075B973-0000-C511-B2FA-0428B188370D}422Complete0 00:07:21Less Than 7 Days20/10/2020 2:58:41 PM
{E075B973-0000-C511-B2FA-0428B188370D}322Complete0 03:22:03Less Than 7 Days20/10/2020 2:37:09 PM
{E075B973-0000-C511-B2FA-0428B188370D}222Complete0 00:46:35Less Than 7 Days05/08/2020 11:28:05 AM
{E075B973-0000-C511-B2FA-0428B188370D}122Complete0 04:24:59Less Than 7 Days04/08/2020 10:38:39 PM

 

Please advice on how to achieve this?

 

Thanks,

Varun

Labels (3)
1 Solution

Accepted Solutions
Gysbert_Wassenaar

Perhaps like this:

Temp1:
LOAD * FROM ...source...;

Data:
NOCONCATENATE LOAD *, Cycle as CycleLookUp RESIDENT Temp1 WHERE [Overall Status] = 'Complete';

Temp2:
NOCONCATENATE LOAD * RESIDENT Temp1 WHERE NOT Exists(CycleLookUp,Cycle);

INNER JOIN (Temp2) LOAD max(Cycle) as Cycle RESIDENT Temp2;

CONCATENATE (Data)
LOAD * RESIDENT Temp2;

DROP TABLE Temp1, Temp2;

DROP FIELD CycleLookUp;


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

Perhaps like this:

Temp1:
LOAD * FROM ...source...;

Data:
NOCONCATENATE LOAD *, Cycle as CycleLookUp RESIDENT Temp1 WHERE [Overall Status] = 'Complete';

Temp2:
NOCONCATENATE LOAD * RESIDENT Temp1 WHERE NOT Exists(CycleLookUp,Cycle);

INNER JOIN (Temp2) LOAD max(Cycle) as Cycle RESIDENT Temp2;

CONCATENATE (Data)
LOAD * RESIDENT Temp2;

DROP TABLE Temp1, Temp2;

DROP FIELD CycleLookUp;


talk is cheap, supply exceeds demand
Varun1
Partner - Contributor III
Partner - Contributor III
Author

Hi Gysbert,

Thank you for your suggestion however, the output i am getting from your suggestion does not include the latest cycle i.e. Cycle 6. Please let me know how i can add that so i can get the output as mentioned before.

Thanks in advance.

Gysbert_Wassenaar

WFM.


talk is cheap, supply exceeds demand
Varun1
Partner - Contributor III
Partner - Contributor III
Author

Sorry my bad.

Thanks a ton for the solution