MongoDB earned a higher gross margin in its October quarter even though its subscription business, which supplies 97% of revenue, earned a lower margin. The explanation sits in the much smaller consulting and training operation. That business still cost more to deliver than customers paid, but its loss shrank enough to change the direction of the companywide comparison.

In its December 1 quarterly filing, MongoDB reported $24 million in services revenue and $25.47 million in related costs for the three months ended October 31. The resulting $1.47 million gross loss compares with a $13.01 million loss in the same quarter a year earlier. The company attributed the cost reduction chiefly to lower spending on outside consultants.

To isolate the effect, hold the services loss at last year’s dollar amount and leave this quarter’s revenue and subscription gross profit as reported. On that basis, companywide gross profit would have been about $555.4 million on $781.7 million of revenue, a margin of roughly 71.0%. Last year’s actual margin, calculated from the unrounded statement figures, was about 71.5%. Shrinking the services loss helped turn that decline into the reported improvement to about 72.5%.

The underlying subscription business still generated most of the additional gross profit in dollars. Its margin, however, slipped from 76% to 75% on the company’s rounded figures. Third-party cloud infrastructure expense rose $40.2 million. The quarter illustrates how the economics of delivering a database subscription can move differently from the headline margin investors see for the whole company.