When a rental property is used for both personal and rental use during the year, you can only take a percentage of the expenses based on the number of days the property was rented.
For mortgage interest and real estate taxes, there are two methods that can be used to prorate the rental part of the expense. The Tax Court method calculates the rental part by dividing the number of days rented by the number of days in the year. The other method is the IRS Method, which takes the ratio of days rented to days used. On TurboTax there's a question that lets you select what method you want to use. See the image below.
For more information refer to IRS Publication 527.