nPath - finding trailers for similar rows

Aster
Highlighted
Visitor

nPath - finding trailers for similar rows

Hi, I am trying to use an nPath query to solve this problem (similar to the examples on the bank clicks but I can't figure out how to apply those examples):

 

I have a table in which the last row ordered by incremental id contains some values (x,y,z in the example below). I need to find all the trailing rows (the ones occuring AFTER) to any previous row in the table that contains at least N (1,2,3,...) values equal to one of the values in the last row. Below the pink label is the reference row and the blue ones are the trailers occuring after rows containing at least a value from the reference. As you see the issue is that sometimes the trailers can be consecutive rows. Can anybody share some info on this issue? Thanks

    aster_trailers.jpg