The software-as-a-service (SaaS) business model has created vast wealth for investors. By developing a product that scales cheaply, and is protected by high switching costs, many of these companies are capturing customers for life with ease.

Shopify (NYSE:SHOP), which has a platform for anyone wishing to create a business with an e-commerce presence, and Veeva Systems (NYSE:VEEV), which offers cloud-based software solutions to drug companies, are prime examples. The two have returned an average 660% over the past three years alone.

They have both clearly been good choices for your portfolio in the past. What about moving forward? Between these two, which is the better bet for your hard-earned cash?

GOOD BETTER BEST writen on old torn paper with clip hanging on white background

Image source: Getty Images

We can never know for sure which will outperform, but by comparing the companies on three different criteria, we can get a better idea of which is stronger.

Financial fortitude

First, we'll evaluate financial fortitude. The simple thing we want to know: If there were a recession today, which company would benefit the most from it?

Benefit from a recession? Sounds odd, doesn't it.

But companies that have lots of cash on hand, strong cash flow, and little debt can do just that. They can acquire smaller rivals, buy back shares at a discount, and capture long-term market share that's left open when weaker industry players fold.

Keeping in mind that Shopify's market cap is roughly 50% larger than Veeva's, here's how the two stack up.

Company Cash Debt Free Cash Flow
Shopify $2 billion $0.1 billion $3.5 million
Veeva $1.1 billion $0 $302 million

Data source: Yahoo! Finance. Cash includes long- and short-term investments. Free cash flow presented on trailing-12-month basis.

At first glance, it might appear that Veeva has the upper hand. Both companies are in an enviable position when it comes to their war chests -- over a billion in cash with (almost) no debt to speak of. And with Veeva producing such strong cash flow, it would appear to be the winner.

But I don't think it's as simple as that. Shopify is chasing a much bigger addressable market, and is spending hand over fist to capture it. If a recession hit tomorrow, it could easily tap on the brakes and sales would flow right into free cash flow. 

Winner = Tie


Next, we have valuation. I like to consult a number of different variables for this exercise.

Company P/E Ratio P/FCF Ratio PEG Ratio P/S Ratio
Shopify 650 8,500 8.9 25
Veeva 87 70 4.2 24

Data sources: E*Trade and Yahoo! Finance. P/E presented using non-GAAP earnings.

As you can see, because Shopify reinvests so much of its sales into growth, it becomes next to impossible to get a reading for where the company stands -- especially against Veeva. While no one in their right mind would argue that Veeva's stock is cheap, the fact that it has substantial earnings and free cash flow makes it the clear winner here.

Winner = Veeva

Sustainable competitive advantages

Finally, we have sustainable competitive advantages -- commonly referred to as "moats." As I mentioned at the outset, both companies are protected by wide moats in the form of high switching costs. In plain English, this means that customers of these two companies would face enormous costs -- both financial and logistical -- if they wanted to switch to different software providers.

If we're trying to figure out which one has higher switching costs, I would argue that Veeva comes out ahead. While merchants don't like the idea of adopting a new platform to sell things on the internet, drug companies would face an existential crisis if they were forced to abandon their platform of choice.

That's because Veeva tailors its services to clients with many more employees and much more mission-critical data than Shopify. It's not that Shopify's switching costs are small, it's just that it focuses on small and medium-sized businesses. Veeva has many big pharma names on its roster -- retraining all of the employees at a huge drug firm on a new cloud platform would be an enormous headache. And a transition to one of Veeva's competitors would run the risk of losing mission-critical trial data stored on the cloud.

However, Shopify would still come out ahead as a wider-moat business. That's because it also benefits from the network effect. Shopify has opened up its platform to third-party app developers. Those developers have produced over 2,500 apps for Shopify merchants to use, and they wouldn't be available on a start-up's platform. Because of the regulated nature of Veeva's clients, it just can't offer that same service.

Winner = Shopify

My winner is...

As you can probably tell, I'm a big fan of both of these companies. In fact, they combine to account for over 13% of my real-life holdings. Veeva's cheaper, Shopify has a wider moat, and they both have a strong measure of financial fortitude. When there's a tie like this, I always side with the wider-moat company. In this case, that means Shopify. But you'd be doing yourself a big favor to investigate both companies for your own portfolio.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.