How was the property used during full period of ownership?
Any period used as PPR and last 12 months of ownership are not taxable.
Calculate full gain and then apportion x period liable / total period.
Note, to qualify for last 12 months of ownerhip exemption, the property mush have been used as PPR at some point in time. This exemption was introduced to allow people time to sell a property (after moving out).