Investors & landlords

Thank you and I did expect that to be the case but how do I show that?

For example, if I earned $20000 in 2021 and paid tax on that but that re-investment went towards a $50000 profit in 2022 how do I separate the two, so I only pay on $30000?