Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Rsaiq
Creator
Creator

Get record from a table which is next date from current date

Hi All,

I have log file and I am tracking when the file is going to fail.

So,in my dataset i have some assumptions that files are going to fail on a particular  date. 

So,I need to check the next date when the file is going to fail from current date e.g.

20230115_182908.jpg

For  ID=1

I need to add record in new table for date   04/01/2024 because it is next date  from current date as 04/01/2023 is passed.

For ID=2

I need to add record in new table for date   22/12/2023 because it is next date  from current date as 22/12/2022 is passed.

And we don't need to consider 22/12/2024 as before this date we have 22/12/2023.

Below is the expected result.

20230115_183126.jpg

Thanks in advance

Labels (2)
1 Solution

Accepted Solutions
rubenmarin

Hi, with the peek() function and a sorted table you can also do this, it's very simila to this post: https://community.qlik.com/t5/New-to-Qlik-Sense/Get-value-on-max-date-by-ID/td-p/2025856

in this case the order by date doesn't have to be descendant, and a few more checks with peek():

If(ID=Peek(ID) and Peek(Status)='Failed' and Status='To Fail',1,0) as isNextToFail

View solution in original post

1 Reply
rubenmarin

Hi, with the peek() function and a sorted table you can also do this, it's very simila to this post: https://community.qlik.com/t5/New-to-Qlik-Sense/Get-value-on-max-date-by-ID/td-p/2025856

in this case the order by date doesn't have to be descendant, and a few more checks with peek():

If(ID=Peek(ID) and Peek(Status)='Failed' and Status='To Fail',1,0) as isNextToFail