Since Warren Buffett took over the company in 1965, Berkshire Hathaway (BRK.A -0.76%) (BRK.B -0.69%) has made shareholders a lot of money. Between 1965 and 2022, the large conglomerate generated compounded annual gains of 19.8%, which compares nicely to the broader benchmark S&P 500's 9.9% average gain.

Zooming in, Berkshire has also made many moves in recent years and has seen its stock hit all-time highs. If you invested $2,000 in 2017, here's how much you'd have today.

Finding different ways to put money to work

One of Berkshire's big moves over the last six years was continuing to build its stake in the consumer tech giant Apple (AAPL -0.35%), which Buffett first purchased in 2016. He has previously talked about how he first got interested in Apple after noticing how distraught his friend was when he couldn't find his iPhone.

Warren Buffett.

Image source: Motley Fool.

In 2017, Buffett and Berkshire got serious about Apple, boosting their position from 230 million shares at the end of 2016 to nearly 662 million shares at the end of 2017. Currently, Apple consumes more than 46% of Berkshire's more than $375 billion equities portfolio.

It's been a tremendous investment for Berkshire. Since the start of 2017, Apple's stock is up roughly 560%.

When the pandemic hit in 2020, most investors' investing approach changed dramatically, given that the world had transformed massively. Berkshire made a lot of big changes, including selling off all of its airline stocks and a lot of bank stocks, as well.

The conglomerate remained patient immediately after the onset of the pandemic but then began to deploy some of its massive cash hoard. It started with Berkshire repurchasing a lot of its own stock: nearly $25 billion in 2020 and more than $27 billion in 2021.

Then Berkshire began to venture into other sectors. The pandemic and Russia's eventual invasion of Ukraine would start what would ultimately be another big foray into energy stocks and acquisitions. Berkshire would acquire Dominion Energy in 2020 and then initiate major stakes in the U.S. domestic oil producers Occidental Petroleum and Chevron.

In 2022, Berkshire invested $60 billion in various stocks in the first six months of the year, not including stock sales. These new positions included multibillion-dollar stakes in Citigroup, Paramount, and Activision Blizzard.

Berkshire has also looked abroad, investing in the initial public offering of the Brazilian fintech Nu Holdings and building large multibillion-dollar positions in five of Japan's large trading companies. Buffett seems to like them because they remind him of Berkshire.

If you had invested $2,000 in Berkshire...

It's been a bumpy last six years, especially when you think about market conditions since the pandemic began, but Berkshire has managed to perform well. It's also proven to be a rock at times when the market has struggled -- like last year.

So if you had invested $2,000 in Berkshire's stock at the very beginning of 2017, you'd now have $4,277. If you had invested $2,000 in the broader benchmark S&P 500 index, you'd now have $3,972, making Berkshire's stock the better investment.