Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get handle of previous row only if the field contains specific value

In the sample file, I would like to get the start time(Date) only if the Status is Inprocess

5 Replies
sujeetsingh
Master III
Master III

Go for the Previous() function.

Let here be the table

ID,Sales,Date           ,Previous(Date)

1  ,12     ,12/12/2014   ,-

1  , 13    ,13/12/2014   ,12/12/2014

sujeetsingh
Master III
Master III

previous(expression )

Returns the value of expression using data from the previous input record. In the first record of an internal table the function will return NULL. The previous function may be nested in order to access records further back. Data are fetched directly from the input source, making it possible to refer also to fields which have not been loaded into QlikView, i.e. even if they have not been stored in its associative database.

Examples:

Load *, Sales / previous(Sales) as Increase from ...;

Load A, previous(previous( A )) as B from ...;

tresesco
MVP
MVP

Can you add one more column to your sample excel that would show your expected output?

MK_QSL
MVP
MVP

You need to use Previous Function in the script... Kind request you to elaborate little more on your requirements as your question is not describing anything about what you want to have as end result..

Thanks

Not applicable
Author

Check this, Just an example based on your excel data. for using previous with an if condition.

if(date>previous(date) and team=previous(team) and status!=previous(status),'Process is Stable','Check the Process')

Here, Teams should be of same and dates are increasing in time but status is not equal to previous one, then give those strings for those row columns.

You can use this in more scenarios.

-AD