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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ineshsingh
Contributor
Contributor

Getting top 5 entries based on end date

I need to show top 3 items based on their end dates

ID Service End Date
33855 XYZ 1-Jun-23
5400 YZB 27-Aug-23
28004 XSD 31-May-23
26146 ASA 12-Jul-23
14358 LKI 30-Jun-23
26054 BKJN 3-Jan-24
32883 YFK 12-Aug-25

 

It should display:

ID Service End Date
28004 XSD 31-May-23
33855 XYZ 1-Jun-23
14358 LKI 30-Jun-23

 

and Additional if I can display text saying  - "Service XSD going to expire on 31st May 2023"

Labels (4)
1 Solution

Accepted Solutions
QFabian
MVP
MVP

Hi @Ineshsingh , i made this example, hopes works for you :

 

//Script  to format the field as date :

Aux:
Load * INLINE [
ID, Service, EndDate
33855, XYZ, 1-Jun-23
5400, YZB, 27-Aug-23
28004, XSD, 31-May-23
26146, ASA, 12-Jul-23
14358, LKI, 30-Jun-23
26054, BKJN, 3-Jan-24
32883, YFK, 12-Aug-25
];

 

Aux:
Load
ID,
Service,
date#(EndDate, 'dd-MMM-YY') as EndDate2
Resident Aux
order by
EndDate;

drop table Aux;

exit script;

//Then in a straight table :

QFabian_0-1673011472232.png

QFabian_1-1673011496163.png

QFabian_2-1673011551718.png

QFabian_3-1673011580362.png

 

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.

View solution in original post

2 Replies
QFabian
MVP
MVP

Hi @Ineshsingh , i made this example, hopes works for you :

 

//Script  to format the field as date :

Aux:
Load * INLINE [
ID, Service, EndDate
33855, XYZ, 1-Jun-23
5400, YZB, 27-Aug-23
28004, XSD, 31-May-23
26146, ASA, 12-Jul-23
14358, LKI, 30-Jun-23
26054, BKJN, 3-Jan-24
32883, YFK, 12-Aug-25
];

 

Aux:
Load
ID,
Service,
date#(EndDate, 'dd-MMM-YY') as EndDate2
Resident Aux
order by
EndDate;

drop table Aux;

exit script;

//Then in a straight table :

QFabian_0-1673011472232.png

QFabian_1-1673011496163.png

QFabian_2-1673011551718.png

QFabian_3-1673011580362.png

 

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
QFabian
MVP
MVP

@Ineshsingh Excelent!, here is included the comment :

Aux:
Load * INLINE [
ID, Service, EndDate
33855, XYZ, 1-Jun-23
5400, YZB, 27-Aug-23
28004, XSD, 31-May-23
26146, ASA, 12-Jul-23
14358, LKI, 30-Jun-23
26054, BKJN, 3-Jan-24
32883, YFK, 12-Aug-25
];

 

Aux:
Load
ID,
Service,
date#(EndDate, 'dd-MMM-YY') as EndDate2,
'Service ' & Service & ' going to expire on ' & date#(EndDate, 'dddd-MMM-YYYY') as Comment
Resident Aux
order by
EndDate;

drop table Aux;

exit script;

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.