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: 
Not applicable

Check the Last 2 Rows and the Next 2 Rows

Hello,

I have a table with the following fields:

ACCOUNT_IDSEQUENCE_IDFLAG
0011Y
0012Y
0013N
0014Y
0015Y

I want to create an expression to evaluate if there's a FLAG=N between two FLAG=Y like the case I showed for ACCOUNT_ID=001

Is there any way to check the row with a FLAG=N and then see if the last 2 rows are Y and the next 2 rows are Y?

Or it is better to do it in the script? How could I do it?

I would like to show the accounts that satisfy this conditions.

Thank you!!!

Labels (1)
1 Solution

Accepted Solutions
maxgro
MVP
MVP

maybe

a straight table with 2 dims

ACCOUNT_ID SEQUENCE_ID

2 expressions

FLAG

match(above(FLAG) & above(FLAG,2) & FLAG & below(FLAG) & below(FLAG,2), 'YYNYY')

View solution in original post

1 Reply
maxgro
MVP
MVP

maybe

a straight table with 2 dims

ACCOUNT_ID SEQUENCE_ID

2 expressions

FLAG

match(above(FLAG) & above(FLAG,2) & FLAG & below(FLAG) & below(FLAG,2), 'YYNYY')