Home prices in Portland, Oregon, are soaring.

On a monthly basis, the local newspaper catalogs homes that sold above list price. The latest installment includes 34 homes that sold for 15% to 42% over list price in April.

Portland isn't the only city that's seeing this trend. Nearly two dozen other major metropolitan areas are experiencing rising prices.

If you're looking for an explanation, look no further than the inventory of homes for sale.

A line chart of monthly housing inventory.

Data source: Federal Reserve. Chart by author.

As a general rule, home prices rise when the number of homes for sale equals less than the previous six months' worth of actual home sales in that market. So, if there are 1,000 homes for sale in a particular city and 500 homes sell each month, the inventory is equal to two months' worth of sales.

The latest figure in Portland is 1.6 months, which is well below the six-month threshold. Across the country more generally, the supply of homes for sale equals 5.7 months' worth of sales.

The nationwide housing shortage isn't as acute as it is in Portland, but it's still low enough to likely fuel a continuing climb in home prices this summer.

Offer from The Motley Fool: The 10 best stocks to buy now
Motley Fool co-founders Tom and David Gardner have spent more than a decade beating the market. In fact, the newsletter they run, Motley Fool Stock Advisor, has tripled the S&P 500!*

Tom and David just revealed their ten top stock picks for investors to buy right now.

Click here to get access to the full list!

*Stock Advisor returns as of 5/1/2017.