I am not an accountant but I believe you can also carry forward losses to future years if you do not have any gains at this time. Not sure if you can transfer backwards. Best to contact an accountant for these matters.
You can go back 3 preceding years from the year of your sale. On the other side you can carry forward the loss indefinitely to be offset any capital gains in the future.