This cannot be done. Investors cannot carry over gains to offset losses. Gains are report in the year received.