Hello !

I am trying to assign an incremental value to a row in the case the value = "PFR" or "PFA". So for all instances of PFR or PFA I would like to assign the numbers 1, 2, 3, 4 and so on (depending on how many there are) within the same id number. In the case it doesn't find PFA or PFR I would assign 0. The counter would have to reset every time the ID changes.

Below is an example of the result i'm looking for.

ID Status Decision count
1 CAD 0
1 PFA 1
1 RCA 0
1 PFR 2
1 PCF 0
1 PFR 3
1 PCF 0
2 CAD 0
2 PFA 1
2 PCF 0
2 PCV 0
2 RCA 0
2 PFR 2
2 PCV 0
2 PCV 0
2 PFR 3
2 PBI 0
2 SIN 0
2 PFR 4