Sometimes people get confused about velocity and edge cases of what gets counted or not. It doesn't matter greatly except it helps to do this consistently over time. I wrote a FAQ for our teams because these edge cases come up infrequently and developers often don't remember what rule to apply. I'm sharing a slightly abbreviated version of our Velocity FAQ as an illustration of working agreements around this. Your team might choose to do this differently and that's okay.

The purpose of this FAQ is to clear up any confusion about counting team velocity before story prioritisation.  We average our velocity over past 3 iterations to level things out. Also we make adjustments if we know that team members will be on holiday during the next iteration.

1) Should I partially count a story if we did some work on it but it hasn’t been finished? No

2) Should I count a story if the code is all live but we haven’t had the story approved by stakeholders or sent out the release email? No because sometimes more work is discovered through doing this.

3) If we extended or shortened the iteration should I adjust the velocity to match the usual iteration length? Yes

4) If the story was signed off and complete and then later we discover it has problems, Should we add another story for the extra work to fix it? No. If the implementation has a bug or we broke or clearly failed to deliver on the story we will fix it without an additional story, even if it was accidentally signed off.

5) My stakeholder says that she really wanted something extra than the story we’ve developed. Do we expand the story to do the extra things? No, this can be a new story if wasn’t agreed with other stakeholders. It helps to note the acceptance criteria clearly in the story and check them with stakeholders before starting work on development.

6) We had to do some story work in an iteration that wasn't planned in because the story was not finished from a previous iteration (due to any reason including dependency on other team). What do we do?

Step 1: Send stakeholder email or let them know in planning that this is happening and may impact stories currently lined up for current iteration.

Step 2: Fix the problem and then count the full estimate of the original story when its finished in the current iteration

Do not create an extra story for the remainder of the work and estimate it as extra work as this will result in artificially inflating the velocity.

7) We did an extra piece of work it took about 2 points worth, it was never planned in or estimated can I count it now because we did do it?

No. New pieces of work even if they come up mid-iteration, even if they are ultra urgent and should be done immediately should always be discussed, broken down and estimated BEFORE we start work on it. We need to warn stakeholders we are putting it in. So this situation should never ever arise that you only estimate a story after you completed it! If it does happen you should not count it. and discuss what went wrong in the process.