Loan interest for rental property

I used my HELOC to purchase a rental property in 2022. The property  took 2 years to complete the build - 2024. Can I claim there interest from that loan as an investment expense for those two years or does it need to be for each calendar year, even though it wasn't built yet.

Thank You