Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Imbue20
Contributor
Contributor

Get name of the key with max date

Required is the Name of the key with Max date

IMG_20230719_224958.jpg

th Max dat 

Labels (1)
1 Solution

Accepted Solutions
PrashantSangle

try this code

Test:
Load *, Key&'_'&new_Date as max_key_date;
Load Name,Key,Date(Date#(Date,'DD/MM/YYYY')) as new_Date inline [
Name, Key, Date
SK153, AKU_KK, 7/11/2023
SK150, AKU_KK, 7/4/2023
SK981, AKU_KK, 3/7/2023
SK154, AKU_KU, 7/4/2023
SK982, AKU_KU, 3/7/2023
];
 
NoConcatenate
 
max_key_date:
Load Key&'_'&Date(max_date) as max_key_date;
Load Key,
max(new_Date) as max_date 
Resident Test
Group by Key;
 
Left Join
Final:
Load Name, max_key_date Resident Test
;
 
drop table Test;
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

View solution in original post

8 Replies
BrunPierre
Partner - Master
Partner - Master

This can be one way.

Dimensions: Key & Date

Measure: Aggr(FirstSortedValue(Name,-Date), Key)

Imbue20
Contributor
Contributor
Author

Thanks Brun , 

But this didn't solve my query, if I tried this

Firstsortedvalue(Name,-aggr(Date,Key)) 

I am getting name whose key is having only 1 record, but if there are 2-3 records for that key am not getting any value.

REGARDS.

PrashantSangle

where do you want this?? in front end or back end??

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
PrashantSangle

try this code

Test:
Load *, Key&'_'&new_Date as max_key_date;
Load Name,Key,Date(Date#(Date,'DD/MM/YYYY')) as new_Date inline [
Name, Key, Date
SK153, AKU_KK, 7/11/2023
SK150, AKU_KK, 7/4/2023
SK981, AKU_KK, 3/7/2023
SK154, AKU_KU, 7/4/2023
SK982, AKU_KU, 3/7/2023
];
 
NoConcatenate
 
max_key_date:
Load Key&'_'&Date(max_date) as max_key_date;
Load Key,
max(new_Date) as max_date 
Resident Test
Group by Key;
 
Left Join
Final:
Load Name, max_key_date Resident Test
;
 
drop table Test;
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Imbue20
Contributor
Contributor
Author

Hi Prashant, 

I need it back end 

Imbue20
Contributor
Contributor
Author

Can you help me to achieve this  in front end ?

 

PrashantSangle

in back end. Logic which I provided in my earlier reply will work.

For Front end what you want to do? From earlier logic remove Left join part and use that max_key_date table for flagging and use that flag in front end

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Imbue20
Contributor
Contributor
Author

I want to make these Names as default selection with i open the sheet in front end.