This question is about the specific definition of the baseball statistic AVG w/ RISP. Suppose there is a runner on first with no outs. When the count is 2-2, the runner successfully steals second base and the pitch is called a ball. On the very next pitch, the batter strikes out. Does this count against the batter's average with runners in scoring position? The runner was only in scoring position for one pitch, but there were five pitches where the runner was not in scoring position.
I can answer this, but I don't know how to 'source' it. All at-bat (or plate appearance) statistics only take effect when the plate appearance is over.
In your example, AVG w/ RISP takes into account all at-bats that end with a runner in scoring position. So yes, even though only one pitch had a runner in scoring position, that was the only pitch that mattered, as it was the last pitch in the at bat.
Similarly, stats such as a batting average on 2-0 counts are unaffected by plate appearances that don't end on the 3rd pitch. And even an intentional walk only requires the last pitch to be an intentional ball.