Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Asiolinka
Contributor III
Contributor III

I need to obtain records with fresh status

Hi Everyone,

I have below data: 

ID Date Description  Status
123 01.03.2023 car accident  open
123 01.04.2023 car accident  in progress
123 01.05.2023 car accident  closed 
125 01.06.2023 phone permanent low battery open 
127 01.07.2024 VPN issue open
127 03.07.2024 VPN issue in progress

 

How can I obtain a table in which is only the line with the last date status? 

Date form: DD.MM.YYYY

Could you please help me? 

 

Labels (3)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master
Partner - Master

BrunPierre_0-1696255736851.png

T:
LOAD ID,
Date(Date#(Date,'DD.MM.YYYY'),'DD.MM.YYYY') as Date,
Description,
Status
FROM
[https://community.qlik.com/t5/New-to-Qlik-Sense/I-need-to-obtain-records-with-fresh-status/td-p/2124...]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

Inner Join
LOAD ID,
Max(Date) as Date
Resident T
Group By ID;

View solution in original post

3 Replies
AronC
Partner - Creator II
Partner - Creator II

In backend you can use group by. You sort on date and choose last value.
Like this:
NewTable:
Load
ID,
max(Date) as Date,
LastValue(Description) as Description,
Lastvalue(Status) as Status
resident OldTbl
group by ID
order by Date;
drop table OldTbl;

AronC
Partner - Creator II
Partner - Creator II

In frontend you can use the function FirstsortedValue. 
With you data it will look like below. You can see the expression in the screenshot. I did change your date to  a field NewDate to make sure it was numeric. If your date is a string you must cast it. I used: floor(Date#(Date, 'MM.DD.YYYY')) as NewDate.

AronC_0-1696249501345.png

 

BrunPierre
Partner - Master
Partner - Master

BrunPierre_0-1696255736851.png

T:
LOAD ID,
Date(Date#(Date,'DD.MM.YYYY'),'DD.MM.YYYY') as Date,
Description,
Status
FROM
[https://community.qlik.com/t5/New-to-Qlik-Sense/I-need-to-obtain-records-with-fresh-status/td-p/2124...]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

Inner Join
LOAD ID,
Max(Date) as Date
Resident T
Group By ID;