This type formula should work if the table is sorted:

If**(** Row**()** > **1**,

If**(** :ID == Lag**(** :ID, **1** **)** & :Category == Lag**(** :Category, **1** **)**,

Lag**(** :Outcome, **1** **)** + **1**,

**1**

**)**,

**1**

**)**

The below should also work (but independent of sorting).

Eval**(** Eval Expr**(** Col Number**(** Row**()**, Row**()** > Expr**(** Row**()** **)**, :ID, :Category **)** **)** **)**