Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
gopal5879
Creator
Creator

Based on min value of seq number for Key , create new table less than target sequence number,

 

Hello folks Need little help, I am scratching my head about doing this. I have table Triage_Claim , I can find target rows for each of triage_Claim_id key in table Triage_Claim 

I am trying to create table Triage_Review from Triage_Claim with seqno less than target for each of triage_claim_id  values.

Can someone offer me clue how to achieve this?  Thanks a lot.

 

Triage_Claim  
Triage_claim_id seqno 
10011 
10012 
10013target 
10014 
10015 
10021 
10022target 
10023 
   
   
   
Triage_Review  
Triage_claim_id seqno 
10011 
10012 
10021 
5 Replies
jwjackso
Specialist III
Specialist III

Using the data below:

Triage_Claim:
LOAD * Inline [
Triage_claim_id,seqno,target_fld
1001,1,''
1001,2,''
1001,3,'target'
1001,4,''
1001,5,''
1002,1,''
1002,2,'target'
1002,3,''
]
;

mapTriage_Review:
Mapping
LOAD Triage_claim_id,
seqno
Resident Triage_Claim where target_fld = 'target';


Triage_Review:
Load Triage_claim_id,
seqno,
TriageFLG
where TriageFLG = 'Y';
LOAD Triage_claim_id,
seqno,
If(ApplyMap('mapTriage_Review',Triage_claim_id) > seqno,'Y','N') as TriageFLG
Resident Triage_Claim;

You can filter on the triageFLG:

triageFLG.PNG

 

Taoufiq_Zarra

One Option :

Triage_Claim:

LOAD * INLINE [
    Triage_claim_id , seqno, target 
    1001, 1,  
    1001, 2,  
    1001, 3, target 
    1001, 4,  
    1001, 5,  
    1002, 1,  
    1002, 2, target 
    1002, 3,  
];

Triage_Review_tmp:

load Triage_claim_id , seqno resident Triage_Claim;
left join
load Triage_claim_id , seqno as S  resident Triage_Claim where target='target';

Triage_Review :

load Triage_claim_id , seqno resident  Triage_Review_tmp where seqno<=S;

drop table Triage_Claim,Triage_Review_tmp;

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Saravanan_Desingh

One solution in front-end is:

tab1:
LOAD * INLINE [
    Triage_claim_id , seqno, target 
    1001, 1,  
    1001, 2,  
    1001, 3, target 
    1001, 4,  
    1001, 5,  
    1002, 1,  
    1002, 2, target 
    1002, 3,  
    1003, 1,  
    1003, 4, target 
    1003, 3,      
];

Dimension: Triage_claim_id , seqno

Expression: If(seqno<Only({<target={'target'}>}TOTAL <Triage_claim_id> seqno),seqno)

 

Saravanan_Desingh

Output.

commQV35.PNG

Brett_Bleess
Former Employee
Former Employee

You have received multiple responses to your post, we would greatly appreciate it if you would return to the thread and close things out by using the Accept as Solution button on the post(s) that helped you get things sorted.  This gives credit to the poster(s) and lets the other Members know what worked.  If you did something different, you can post what you did and then mark that post, and if you have further questions, please leave an update.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.