Dollar General (DG -0.85%) shares have risen by 33% this year (as of Tuesday afternoon), dwarfing the comparable performance of the S&P 500 index and its 0.5% gain. Despite the volatility and uncertainty of the economy, the discount retailer has become a bit of safe haven investment to hold on to this year.

A big test for the retailer will come on June 3, when the company reports its latest earnings numbers. The stock could move quickly following the release of those numbers. Should you buy it before they come out?

Multiple people looking at something on a cell phone.

Image source: Getty Images.

Why Dollar General might surge after earnings

Dollar General stock looks like it's on fire this year, but when you look at its five-year performance, you get a much different picture. The stock is down more than 44% from its mid-2020 price. The reality is that the retail stock still doesn't look all that expensive; it's trading in line with the earnings multiple it has averaged over the past five years.

DG PE Ratio Chart

Data by YCharts.

Because the company primarily focuses on selling domestically produced, essential goods like food, health, and household items, only a small percentage of its inventory (about 4%) is sourced from imports, making it less vulnerable to price increases due to tariffs. This is likely why it has been a popular stock for investors to buy this year.

The stock trades around $101 a share, but it's nowhere near where it was in the early part of 2023 when it was trading just below $240. A solid performance in the most recent quarter and perhaps an encouraging outlook ahead could be what sends the stock on an even bigger rally in the days and weeks after the earnings report.

Why Dollar General might struggle

Dollar General may have relatively limited exposure to tariffs, but that alone may not be enough to ensure it soars higher in value this year. It's also not enough of a reason to expect that its financials will be strong. The company's growth has been choppy in recent years. And without the help of new store openings to pad its top line, its performance would be worse than what the chart below indicates.

DG Operating Revenue (Quarterly YoY Growth) Chart

Data by YCharts.

For the current fiscal year, which ends in January, the company projects net sales growth between 3.4% and 4.4%. But when looking at same-store sales growth, which only factors in the stores open for at least one year, then the growth rate is just 1.2% to 2.2%. Dollar General plans to open 575 new stores in the U.S. during the current fiscal year, and that's a big reason behind its top-line growth. Organically, the business isn't doing nearly as well, and CEO Todd Vasos recently told CNBC that "many of our customers report they only have enough money for basic essentials."

That's not exactly a rosy forecast to suggest the business is in great shape, and worth paying a 20x earnings multiple for.

Should you buy Dollar General stock right now?

Dollar General stock has been doing well this year, but with its valuation now creeping up to its five-year average with respect to earnings, I'd consider cashing out at this point. There's still ample risk facing the company, and with its core customer being in rural areas and potentially more vulnerable to adverse macroeconomic conditions, I wouldn't set my expectations too high for Dollar General's performance for the most recent quarter, or as the year goes on.

It was an undervalued stock heading into this year, and that may have helped it bounce back in recent months, but this is still a risky investment overall, and one that I'd strictly keep on a watchlist for now; there's no need to rush out to buy it today.