The weakening profitability overshadowed a major milestone in the company’s transformation into an AI cloud provider.