Sold condo as rental property

We sold our rental property this year.  We had it for 3 years. During that time we rent it to our son and friends at a discount. So we lost money each of those 3 years. We then spent a lot of money to fix the place up before selling it.  Can we write off the losses from the earlier years? And what can we write off in expenses to fix the place up over 3 years including furnishing it for the renters?