2018 has been a huge win for Shopify (SHOP 1.40%) and Veeva Systems (VEEV 4.98%) shareholders; the stocks have gained 54% and 64%, respectively, so far this year. Software as a service (SaaS) continues to demonstrate its virtues as a model to customers and investors alike, and Shopify and Veeva are two of the best in the business.

However, after those great runs, and with Wall Street showing decreasing favoritism toward high-growth endeavors, it's time to reassess the situation for both SaaS providers.

Metric

Shopify

Veeva Systems 

TTM revenue

$952 million

$811 million

YOY revenue change

41%

18%

TTM operating profit

($89 million)

$191 million

YOY operating profit change

N/A

27%

TTM adjusted earnings

$0.26

$1.41

YOY adjusted earnings change

N/A

53%

TTM = trailing 12 months ending Sept. 30, 2018 for Shopify, and Oct. 31, 2018 for Veeva Systems. YOY = year over year. Data sources: Shopify, Veeva Systems, and YCharts.

Growth at all costs versus growing the bottom line

Though Shopify is the larger of the two companies, it is still unprofitable as it focuses on capturing a bigger piece of the e-commerce industry. That isn't to say Shopify doesn't have the potential to make good money via its SaaS platform for online merchants; gross profit margin was 56% during the first three quarters of 2018. However, the company is plowing large sums of cash back into the business to grow operations. As a percentage of total revenue, the company spent 35% on sales and marketing and 22% on research and development this year.

Veeva, on the other hand, is making a transition to profitable growth, easing back on its spending increases in favor of boosting the bottom line. The company's software offerings for life sciences companies (including healthcare, pharmaceuticals, and biotech) continue to yield higher results -- revenue has increased 25% year over year through the first three quarters of fiscal 2019 -- but expenses are growing at a slower rate. Veeva's cost of revenues have increased by 18% so far in fiscal 2019, and operating expenses have increased by 24%. The result is a fast-growing bottom line; unadjusted earnings are up 42% over that same period.

An artist's illustration of cloud computing and software as a service. Computers are connected to a picture of a cloud.

Image source: Getty Images.

Which is the better buy?

You can't make an apples-to-apples comparison between Shopify and Veeva, and not just because their respective clienteles in retail and the life sciences are so different. The two companies are also in different stages of their development.

Shopify still has its foot on the gas, steadily increasing its spending (and thus its operating loss) to keep its sales numbers heading north as quickly as possible. Profitability will be a concern later. For now, therefore, the stock price can be expected to reflect the trajectory of sales. While Shopify's 41% revenue increase over the last 12 months is nothing to balk at, the growth rate is diminishing as the company gets bigger. Paired with a frothy price to sales ratio of 16.2, that could lead to share price volatility if growth rates in the coming quarters fall below what Wall Street is comfortable with -- especially as operating losses mount. For comparison's sake, SaaS peer company Salesforce (NYSE:CRM) has a price to sales ratio of just 8.4, and it too is growing year-over-year revenue by double digits. Salesforce's top line has increased 26% so far in 2018. 

For Veeva, sales growth is still important, but at this point, profitable expansion is the goal. Thus, the stock will more closely track the bottom line from here on out. Veeva is by no means cheap based on common profit metrics, though. Its price-to-earnings ratio is 74.2, and its price-to-free-cash-flow ratio (free cash flow is money left over after basic operations and capital expenditures are paid for) is 51.6. Either way, that's over half a century of profits if an investor bought today; but if Veeva can keep growing earnings at the rate it has been as of late, that metric will quickly shrink.

So which stock is the better buy? Both are priced for perfection at the moment, so I'd advise caution -- though both are worthy portfolio additions for investors who can tolerate a wild ride. The stock market has been volatile as of late, so a drop in either stock could set up an opportunity to buy dips in small chunks.

Shopify and Veeva cater to huge industries that are still transitioning to digital-first models -- shifts that are driving the rapid expansion at both SaaS companies. With momentum at their backs, buying the dips should be a winning strategy for both stocks over the long haul.