It took Warren Buffett almost nine years after the first iPhone was sold to pull the trigger on buying Apple inc.’s stock. After nearly three years of rapidly building his stake, Thursday’s stock selloff has likely put his investment underwater.

Based on 13F filings with the Securities Exchange Commission, Buffett’s investment vehicle Berkshire Hathaway Inc. BRK.B, -0.70% took its first position in Apple—9,811,747 shares—during the first quarter of 2016. That was about a year after Apple joined the Dow Jones Industrial Average and a little over three years after Apple resumed paying a dividend. The first iPhone was launched in June 2007.

Since then, he’s increased his stake to 252,478,779 shares, or about 5.3% of the shares outstanding as of Sept. 30, 2018, enough to make him the second largest shareholder. At that time, Buffett’s investment in Apple was valued at about $57 billion, not including dividends.

The stock AAPL, -1.59% tumbled 10% Thursday to the lowest close since April 2017, after the company cut its revenue outlook, citing weaker-than-expected iPhone sales, primarily in China.

The stock has now plunged 38.7% since closing at a record $232.07 on Oct. 3. Over the same time, the Dow DJIA, -0.46% has shed 4,142 points, or 15.4%.

At current prices, the value of Buffett’s stake, assuming it has remained the same size since Sept. 30, would be down about $4 billion on the day, and $21.1 billion since Sept. 30.

Don’t miss: Opinion: Apple lives up to Wall Street’s fears with massive revenue shortfall.

See related: Apple’s ‘darkest day’ in iPhone era triggers flood of price target cuts by analysts.

FactSet, MarketWatch

Berkshire’s 13F filings don’t provide details about the timing or at what price the shares were bought during each calendar quarter. To estimate the value of Berkshire’s stake, the number of shares owned can either be multiplied by Apple’s stock price at the end of the quarter or the average of the daily volume weighted average prices, or VWAP, during the quarter.

With that in mind, Buffett could be down roughly $1.8 billion on his Apple investment since he started building it, based on end-of-quarter prices, or down about $970 million, based on an of average of daily VWAPs provided by FactSet.

The following table shows how Buffett built his Apple stake, and why he is likely losing money: