Last 12 months is deemed residency so it would have to be for a greater period than this.
Also the amount of capital loss is pro-rata to the amount of time deemed non-occupancy
eg - suppose overall loss is €100K
You live in the house for 3 years and then rent for 2. Therefore 1 year is deemed chargeable to capital gain.
Therefore you only have a capital loss of €20K to offset against other capital gains.