Find the closest date when an attribute was true

To find the closest date when an attribute was true you use the When Last and When Next functions. These functions look forwards or backwards from a reference date and return a date when a specified boolean attribute is true.

Find the date on which a boolean attribute was last true

To return the date on which a boolean attribute was last true, looking backwards from a reference date (including the reference date), you use the When Last function. This function has the following syntax:

 

For example, to determine when a person's bank balance was last over $100, you would write the following rule in Word:

the date the person's bank balance was last over $100 = WhenLast(the current date,the person's bank balance > 100)

Find the date on which a boolean attribute will next be true

To return the date on which a boolean attribute will next be true, looking forwards from a reference date (including the reference date), you use the When Next function. This function has the following syntax:

 

For example, to determine when was the first time in 2007 that a person's bank balance was over $100, you would write the following rule in Word:

the date the person's bank balance was over $100 for the first time in 2007= WhenNext(2007-01-01,the person's bank balance > 100)