The cloud has changed the business landscape in less than a decade. What once took an army of servers to pull off can now be accomplished with a simple subscription to a service. That's the beauty of Software-as-a-Service (SaaS).

The two companies we're comparing today -- pharmaceutical cloud specialist Veeva Systems (NYSE:VEEV) and inbound-marketing guru Hubspot (NYSE:HUBS) -- have both benefited from this trend. And shareholders have reaped the rewards: On average, the stocks have quadrupled over the past three years.

But which is the better buy today? 

Cloud computing illustration with man in the background

Image source: Getty Images

We can't answer that question authoritatively -- my magic eight-ball is broken -- but we can dig a little deeper. By comparing the two companies across three different dimensions, a winner emerges.

Financial fortitude

When investigating financial fortitude, what I'm really wondering is this: If a financial crisis hit today, how would it affect the company's fortunes ten years from now? There's little doubt all stocks would suffer. But I want to know which companies could actually grow stronger.

How can that happen? Companies with lots of cash, little debt, and strong free cash flows have options during a downturn. They can use their war chests to buy back stock at a discount, acquire distressed but promising start-ups, or simply price the competition out the market.

Keeping in mind that Veeva is valued at over twice the size of Hubspot, here's how the two stack up.

Company Cash Debt Free Cash Flow
Veeva $1.1 billion $0 $302 million
Hubspot $603 million $319 million $62 million

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

Both companies are assuredly on solid financial footing. But if forced to choose, I think Veeva would have the better bet of benefiting from a downturn over the long-run. That cash-rich, debt-free balance sheet helps, as well as the company's very strong free cash flow.

Hubspot isn't in a bad position per se, but it wouldn't have the same type of flexibility as Veeva if times got tough.

Winner = Veeva Systems

Check out the latest earnings call transcripts for Veeva Systems and Hubspot.


Next we have a tougher metric to measure: How expensive are these two stocks relative to one-another? I have consulted four different metrics below to see which comes out on top.

Company P/E P/FCF PEG Ratio P/S
Veeva 69 54 3.6 18.9
Hubspot 187 108 2.5 13.0

Data source: Yahoo! Finance, E*Trade. Earnings calculated on non-GAAP basis.

This is very close. Veeva trades at a 50% discount when we talk about earnings or free cash flow, but Hubspot appears cheaper when taking growth (PEG Ratio) and price-to-sales into consideration.

Make no mistake about it: Both of these companies are expensive. As there's not a clear winner here, I'm willing to call it a draw.

Winner = Tie

Sustainable competitive advantages

Finally, we have what I consider the most important variable to consider: A company's sustainable competitive advantage, or its "moat." Companies with large moats can keep the competition from encroaching for years, while those without one will quickly succumb to the pressures that come with their success.

Both Veeva and Hubspot benefit from high switching costs. This makes sense: Hubspot gives companies a single platform to manage all of their inbound marketing. If that marketing works -- and indications are that it clearly does, especially when Hubspot is the provider -- users are more likely than not to stick with Hubspot. That's because the customer's would much rather focus on their own businesses than worry about migrating data, retraining staff, and dealing with possible downtime from switching away from Hubspot.

Veeva benefits in much the same way. The company has so many cloud applications for drug companies that they're hard to keep track of. Suffice it to say this: Pharmaceutical teams are becoming more reliant on Veeva to do everything -- collect data, comply by regulatory standards, track sales data, you name it. The company's Veeva Vault product in particular has been a huge success.

So how do we pick a winner? I actually think this is pretty easy. SaaS companies have a crucial metric that lets us know how good they are at hanging onto their customers and getting them to pay for more services year after year. The exact name and meaning for that metric differs (dollar-based revenue retention, for example).

For this Veeva is the clear winner. Hubspot's revenue retention sat at 103% last year. That's nothing to sneer at, and on the whole it means that Hubspot is -- hypothetically, at least -- holding onto all of its existing customers from one year to the next, and getting them to spend 3% more per year.

But Veeva's revenue retention is much higher, clocking in at 122% last year. That means its claws are sinking deeper and deeper into the everyday functions of its clients. The moat is wider at Veeva.

Winner = Veeva

My winner is...

So there you have it. Veeva and Hubspot are both very successful companies with expensive stocks. But Veeva's balance sheet strength and widening moat give it the upper hand. Personally, I'm a big believer, as the company accounts for about 5% of my family's real-life holdings. If you're looking for an SaaS investment in your portfolio, Veeva is a great place to start.

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.