CONDITIONAL_TRUE_EVENT

This function assigns an event window number to each row, starting from 0, and increments the number by 1 when the result of the boolean argument expression evaluates true.

Syntax

CONDITIONAL_TRUE_EVENT ( boolean-expression ) OVER 
... ( [ window-partition-clause ] 
... window-order-clause  )

Example

Given a sequence of values for column x, as follows:

(10, 7, 11, 8, 12 ,9)
CONDITIONAL_TRUE_EVENT(x > 3) 

returns 1,0,2,0,3,0.