When the billionaire investor trimmed his stake in Walmart by 7 percent, he said the move wasn't a reflection of a souring stance on the retailer but a decision to free up cash for acquisitions. Berkshire Hathaway still owns $3 billion worth of Walmart stock.

Walmart Shares Down 31 Percent So Far This Year

Source: Bloomberg

But the sale does come at an ominous time for the big-box retailer. Walmart on Tuesday reported a 1.5 percent increase in sales at its established US stores and adjusted earnings per share of $1.03 for the third quarter -- within its guidance and beating Wall Street expectations. Shares were up nearly 3 percent Tuesday morning.

But even with that gain, Walmart's shares are down 31 percent so far this year -- for good reason.

A closer look at Walmart's third-quarter performance reveals a 1.3 percent drop in revenue from the year before. Sales and profit per square foot were also down. And adjusted EPS fell 10.4 percent, the third consecutive quarter of declining profits.

Walmart's Shrinking Profits

Bloomberg

So why are positive headlines pushing the stock up? Like most things in life, it comes down to expectations.

At its investor meeting last month, Walmart's shares fell 10 percent -- the largest one-day drop in 27 years -- after it said the money it was plunging into wages and e-commerce would take a huge chunk out of profits for the next three years. The world's largest retailer at a half-trillion dollars in annual sales is in "growth mode," it told investors, asking them to please be patient. It said it didn't expect to post EPS increases until its fiscal year 2019, while guiding toward flat sales in the current year.

At the time, CEO Doug McMillon told CNBC's Jim Cramer that Walmart was doing all the right things to position itself for long-term growth and that the real problem was in his messaging. "Maybe I'm not telling the story as well as I need to," McMillon said.

Those rock-bottom forecasts sent the right message for the short term, though, lowering expectations for the latest quarter. In a painful environment for retailers across the board, all Walmart had to do to please Wall Street was to simply stick to its guidance. It's a time-tested tactic for short-term gains.

In terms of catching up to Amazon, it doesn't look like the billions of dollars Walmart is plunging into e-commerce are cutting it: Online sales growth in the third quarter fell to 10 percent year over year, the lowest since Walmart began breaking out e-commerce sales.

Online Sales Growth Is Slowing At Brick And Mortar Retailers

Year Over Year Change In E-Commerce Sales

Source: Bloomberg Intelligence, Company Filings

While Walmart might be starting to make some progress, don't expect its shares to rebound anytime soon.

This column does not necessarily reflect the opinion of Bloomberg LP and its owners.