Donald Trump’s desire to bring coal roaring back has always faced a huge barrier in the form of an unstoppable decline in clean energy prices. But now a new report suggests that the falling costs are set to undercut coal sooner than many expected.

An analysis by Bloomberg New Energy Finance combines knowledge of planned energy projects with economic forecasting in order to predict what’s going to happen in the power sector over the coming decades. And the prediction is one of plummeting costs for renewables, with estimates suggesting that by 2040 prices will fall by 66 percent for solar, 47 percent for onshore wind, and 71 percent for offshore wind.

What really matters, of course, is how those prices will challenge incumbent energy technologies. Solar, the more expensive of the two major renewables, already rivals coal in cost terms in Germany, Australia, the U.S., Spain, and Italy, according to BNEF. But more striking is the fact that this is also expected to be the case in China and India by 2021.

Those milestones will surely lead to greater adoption of clean energy. And the report predicts that of the $10.2 trillion expected to be invested into power generation between now and 2040, 72 percent will be channeled into renewables.

Coal's days appear to be numbered. Earlier this week, an analysis by the British oil firm BP showed that global coal demand has declined for the second year running, with consumption falling by 1.7 percent in 2016 compared to 2015. The decline is even more pronounced in the West: coal consumption fell by 8.8 percent in the U.S. during 2016, and as much as 52.5 percent in the U.K.

BNEF predicts that trend will continue, with the bottom falling out of the coal power sector in Europe and the U.S. by 2040—generation is expected to slump by 87 percent and 45 percent, respectively. China will phase out coal more slowly, but forecasts suggest that its use will peak by 2026. It appears that Barack Obama may well have been right when he predicted that the world’s move toward renewables and away from fossil fuels was irreversible.

Is this all enough for us to meet the goals laid out in the Paris climate agreement? Probably not, according to BNEF: it says that these energy trajectories would put us on course for a 4 percent reduction in carbon emissions from 2016 levels by 2040. To meet the Paris climate goals, it says, would require a further $5.3 trillion investment over the next quarter of a century.

(Read more: BNEF New Energy Outlook, BP Statistical Review of World Energy, “Trump’s Rollback Paves the Way for a New Climate Leader,” “Obama Says the World’s Move Toward Renewables Is 'Irreversible'”)