Retirement tax questions

Fidelity shows a different calculation method.  They would say that the starting balace of 17k and ending balance of 20k, with contribution of 7k means there is a loss not a gain.

They show ($1167.67) loss so $5833.33 to be transfered.

It's at  their website:   https://www.fidelity.com/retirement-ira/recharacterize

How can there be a gain in above example, unless the ending balance is after deducting the $7k contribution?