The answer to this question depends on a number of factors, including the mineral content of the dirt and the exposure to light. Moreover, the balance between the fish and plants in your dirted tank will have a huge impact on the efficiency of dirt used.
In most cases, the nutrients in the dirt will start deteriorating after a year or two, although you might be able to go for a few years without replacing dirt in your aquarium. The more plants you add to your system, the faster the dirt will lose the useful nutrients.