I want to have a rolling count column that tracks the count of a specific value in a column. I want a rolling count of how many times the horse has finished 1st.
This is an example of what I have
| Horse | Position |
|---|---|
| a | 1 |
| a | 3 |
| a | 1 |
| b | 3 |
| b | 1 |
| b | 3 |
| c | 5 |
| c | 2 |
| c | 1 |
This is what I want
| Horse | Position | Count |
|---|---|---|
| a | 1 | 1 |
| a | 3 | 1 |
| a | 1 | 2 |
| b | 3 | 0 |
| b | 1 | 1 |
| b | 3 | 1 |
| c | 5 | 0 |
| c | 2 | 0 |
| c | 1 | 1 |