Investors seem to be endlessly fascinated by what's in Warren Buffett's portfolio at Berkshire Hathaway (BRK.A -0.76%) (BRK.B -0.69%). This makes sense, considering the fact that he is one of the best investors in the world. While nobody should purchase a stock simply because Buffett owns it, Berkshire's portfolio can be a great place to look for ideas.

Part of Buffett's success at Berkshire has stemmed from his strategy of holding what he buys for long periods of time. You typically don't see him trading frequently in and out of stocks. But among the holdings in the conglomerate's portfolio today, two companies in particular look like they're worth buying now for the long haul.

1. Snowflake

When Buffett bought Snowflake (SNOW 3.69%) stock at its initial public offering (IPO) price in September 2020, it led to a bit of head-scratching around Wall Street. Buffett has on more than one occasion said publicly that he's not interested in investing in IPOs.

Those comments on buying IPOs and the fact that tech stocks are not typically within his circle of competence have led to a widely held view that one of his lieutenants must have orchestrated the Snowflake buy.

But three years later, individual investors are seeing more clearly what attracted the Berkshire Hathaway team to the stock. While Snowflake's revenue growth has slowed from the triple-digit percentages that it commonly delivered around the time of the IPO, it's still strong. In its fiscal 2024 Q2, which ended July 31, the company posted revenue growth of 36% and generated $69 million in free cash flow.

The company is also clearly providing value to its customers. Snowflake's net revenue retention rate is 142%, which simply means its established customers are spending 42% more on average with Snowflake this year than they did last year.

Companies that grow as quickly as Snowflake has typically trade for a premium, and Snowflake is no exception. The company currently trades at a price-to-sales ratio of 23. That's not cheap, but it's low for this company relative to its historical average ratio of 64.

2. Amazon

Buffett is a fan of powerful brands, and there are few more well-known brands in the world than Amazon (AMZN 3.43%). Buffett first bought Amazon during the first quarter of 2019, and while we don't know precisely the price he paid for those shares, it's safe to say that 2023 has made him feel better about his investment. The stock is up 75% year to date.

With such a large move in the stock's recent past, some investors might think they missed the boat on buying Amazon shares. A closer look at the valuation tells a different story. On both a price-to-sales and price-to-operating-cash-flow basis, Amazon still trades below its 10-year averages.

Meanwhile, investors buying today get a business on the upswing. Revenue growth is accelerating, with year-over-year revenue growth of 13% in Q3. Revenue growth was 11% and 9%, respectively, in the previous two quarters.

More impressive have been its improvements on the bottom line. In Q1 2022, Amazon posted a net loss of $3.8 billion. While the trend line hasn't been straight since then, the overall path has been positive, culminating in net income of $9.9 billion in Q3 2023.

Chart of Amazon's net income over time

Data source: Amazon

One of the biggest drivers of this improvement has been Amazon's North American e-commerce segment, which had been dealing with the hangover of pandemic-induced spending on the distribution network. With that in the rearview mirror, this segment improved from an operating loss of $412 million in Q3 2022 to an operating profit of $4.3 billion in Q3 2023.

This improvement on the bottom line combined with a reasonable valuation makes Amazon shares compelling at today's price. Over the long haul, both Amazon and Snowflake could make shareholders very happy.