Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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;
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;
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.
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;