Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us at Qlik Connect 2026 in Orlando, April 13–15: Register Here!
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator III
Creator III

Get latest plan

Hi Community,

I have to create the flag which will be the following case!

I have two plans that have the sane Insurance ID, and same current/Previous year.

Please note,  we need to show, which are the latest updated plan.

Example: for Insurance ID=BBB,

Output should be the   Case 2, because case 2 has latest updated one.

InsuranceIDStartDateEndDateRate
AAAJan-19Jan-20100
AAAJan-19Jan-20200
AAAJan-19Jan-20240
AAAJan-20Jan-212500
AAAJan-20Jan-21123
BBBJul-18Jan-20250
BBBJul-18Jan-201100
BBBFeb-19Jun-201000
BBBFeb-19Jun-20450

 

OutPut Should be:

InsuranceStartDateEndDateRate
AAAJan-20Jan-212500
AAAJan-20Jan-21123
BBBFeb-19Jun-201000
BBBFeb-19Jun-20450

 

Thanks in Advance!

Labels (2)
1 Solution

Accepted Solutions
Taoufiq_Zarra

Maye be :

Data:
LOAD Date(Date#(StartDate,'MMM-YY')) as ID, * INLINE [
    InsuranceID, StartDate, EndDate, Rate
    AAA, Jan-19, Jan-20, 100
    AAA, Jan-19, Jan-20, 200
    AAA, Jan-19, Jan-20, 240
    AAA, Jan-20, Jan-21, 2500
    AAA, Jan-20, Jan-21, 123
    BBB, Jul-18, Jan-20, 250
    BBB, Jul-18, Jan-20, 1100
    BBB, Feb-19, Jun-20, 1000
    BBB, Feb-19, Jun-20, 450
];
left join(Data)

load InsuranceID, Date(Max(ID)) as MaxDate resident Data group by InsuranceID;


output:
noconcatenate

load * resident Data where ID=MaxDate;

drop table Data;
drop fields MaxDate,ID;

 

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") 😉

View solution in original post

1 Reply
Taoufiq_Zarra

Maye be :

Data:
LOAD Date(Date#(StartDate,'MMM-YY')) as ID, * INLINE [
    InsuranceID, StartDate, EndDate, Rate
    AAA, Jan-19, Jan-20, 100
    AAA, Jan-19, Jan-20, 200
    AAA, Jan-19, Jan-20, 240
    AAA, Jan-20, Jan-21, 2500
    AAA, Jan-20, Jan-21, 123
    BBB, Jul-18, Jan-20, 250
    BBB, Jul-18, Jan-20, 1100
    BBB, Feb-19, Jun-20, 1000
    BBB, Feb-19, Jun-20, 450
];
left join(Data)

load InsuranceID, Date(Max(ID)) as MaxDate resident Data group by InsuranceID;


output:
noconcatenate

load * resident Data where ID=MaxDate;

drop table Data;
drop fields MaxDate,ID;

 

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") 😉