The statement you linked clearly shows a
gross profit and
net loss. "Selling, general and administrative" is not a cost of revenue, hence why it does not count against the gross profit. These are fixed costs not tied to the sales volume that covers the basic operation of the company, advertising, executive compensation, and other overhead costs not directly tied to generating revenue or R&D (since it is a separate line item).
Tesla takes in more revenue than their cars cost to build. It currently is not enough to cover all the other expenses of the company.