Investors & landlords

Would you please elaborate how you develop the historical weighted average to allocate the sales price vs the cost basis? I am trying to do the same for a vacation home which had 40% business use in the first two years and 100% business use in the last year before we sold it. Thanks for your input. Appreciate it.