Contrary to the old saying, a rising tide doesn't necessarily lift all boats. Consider that the S&P 500 is up 16% so far in 2023 and plenty of individual stocks have done even better this year.

But that would not be true for discount chain Dollar General (DG -0.41%). Its shares have cratered an eye-watering 50% so far in 2023, and they now trade at a price-to-earnings ratio of just 12.7. That's the cheapest the stock has sold for at any point in the past decade. 

The low valuation and solid history of rising dividends mean that investors should take a closer look at Dollar General as a top stock to buy on the dip right now. 

Can't ignore the headwinds 

Dollar General reported revenue of $9.8 billion (up 3.9% year over year) and diluted earnings per share (EPS) of $2.13 (down 28.5%) for its fiscal 2023's second quarter, which ended Aug. 4. These headline figures disappointed investors, who sent shares lower since the announcement. Making matters worse was management's decision to lower guidance for the full fiscal year. Executives now expect same-store sales to be flat at the midpoint, with diluted EPS dropping 28% (also at the midpoint). 

It can certainly be discouraging to see Dollar General struggle at a time when its business should actually be thriving. Consumers that are more impacted by inflationary pressures should naturally be focusing more on value and trying to save money, something this retailer specializes in. However, foot traffic decreased in the latest period -- not a good sign. 

Macro headwinds might continue to be a problem in the near term, especially since the economic backdrop remains uncertain.

Long-term track record 

But Dollar General's latest subpar financial results shouldn't scare investors off. If we zoom out, it's clear that this is a top discount retailer that has a strong track record. Between fiscal 2016 and 2021, revenue and diluted EPS increased at compound annual rates of 10% and 13.7%, respectively. 

Consistent and rising profitability, plus free cash flow generation, help explain why the business started paying dividends in 2015. The current yield of 1.9% might be attractive for income-seeking investors. Even more encouraging is that the quarterly payout has grown every year since it was introduced. The payout ratio of 28% means that even though Dollar General is facing some troubles today, it still has ample room to increase what it pays to investors. 

Key to the company's growth strategy is opening more stores. While the management team has decided to scale back its expansion plans this year due to the tough macro environment, the business will still open 990 new locations in the current fiscal year, even though there are already more than 19,000 stores. 

Wall Street expects revenue to increase at an annualized rate of 6% between fiscal 2022 and 2027, so there should still be healthy gains on the horizon. 

Economic moat 

There's no denying that the retail sector is incredibly competitive. Not only are there other discount retailers that directly go up against Dollar General, but the ongoing secular trend of e-commerce means that online shopping might become a bigger threat in the years ahead. 

But investors can have confidence that this business will be able to hold its own over the next several years. That's because Dollar General possesses an economic moat in the form of its cost advantages. Its scale, as exemplified by trailing-12-month revenue of almost $40 billion, has resulted in the ability to obtain favorable pricing on merchandise. That's something a subscale retailer just can't compete with today. And having many stores located in lower-cost rural areas helps control expenses as well. 

This is a competitively advantaged company, one that pays a rising dividend and whose shares are cheap. Yes, it's going through some tough times. But for those investors who believe in the long-term story, maybe it's a smart idea to buy the beaten-down stock now.