Shares in Family Dollar (FDO) are soaring today despite a string of disappointing quarterly results that suggest the business is hurting. This is all thanks to a large stake by activist hedge fund manager Carl Icahn, who is betting on a merger, takeover, or possibly management shakeup to help the company regain its market position.

Lately, the company has been losing market share even as the demand for discount goods has grown. We have seen healthy yearly revenue gains at FDO’s competitors for almost every quarter over the past few years, with strong growth at Dollar General (DG) helping it gain dominance in the market. We’ve also seen strong gains at smaller Dollar Tree (DLTR), which had a slight miss in 4Q13 but has otherwise shown a solid expansion of its business and total market share in the discount goods sector. By charting out the revenue, we can easily see how FDO has lost its way in recent months:

Family Dollar Chart

Click on image to zoom

When an investor sees numbers like this, the first question to ask is why a consumer chooses between FDO, DG, and DLTR. Each has access to the same vendors and suppliers, so it couldn’t be that. They are inherently commoditized businesses—each has “dollar” in their name because they are making an effort to appeal to cost-conscious consumers on price, and on nothing else—so people don’t tend to shop at FDO because it’s a better experience or has better products than DG, or vice versa.

In many, if not all, cases, it comes down to price, selection, and convenience. If you’re shopping at a dollar store, you’re price conscious, so you want a location that is closest to you to save on gas. You also want a location that offers the widest selection, so you can take care of as much shopping at once. These services are easy to offer to customers, and there’s no structural reason why it can’t be offered by all dollar stores in equal amounts.

So why is FDO losing market share? There are many theories to this, but whatever the problem is, it can be fixed. This is where an activist investor can come in, take a large stake, and influence the future of the company. Enter Carl Ichan.

After the news was released, the company’s shares have risen over 14% in intraday trading, which puts the stock up 6% YTD, slightly above SPY. (Before the announcement, it was down over 6%). Those who bought and hold have won with this name; those who bought when it was distressed have won even more.

The game is not over, however. Investors will need to continue to analyze exactly how much of the total addressable market is up for grabs for FDO, if a merger with DG or DLTR is possible, and how the companies’ customer base is changing. One important consideration is how Walmart (WMT) is seeing its customer base transform. This company sits upmarket from the dollar stores and downmarket from Costco (COST), but is substantially larger than both. A portion of WMT’s revenue is up for grabs for the dollar stores, as cost conscious consumers become even more cost conscious. Investors should analyze exactly how much of WMT’s near $500 billion revenue is up for grabs. They should also take a look at Costco, whose low-price model of bulk-buying may appeal to price conscious consumers with a different economic mindset and shopping routine than the dollar stores.

All of this means a lot of due diligence and understanding these businesses. The market has already rushed to bet that Icahn’s bet will pay off, but they may still be undervaluing the opportunity. Alternatively, they may be overvaluing it. A keen investor who models the company’s potential as well as the value of the market at hand will be able to decide which is the truth.