I'm asked from time to time to do margin calculations, especially in reporting.
After looking this up 3 times a year for forever (smiles) I'm just going to create a post so I'll have it.
The value of this article is in the menu structure (above). Follow the link that says 'This article, and all our great SQL (General) documentation'... and remember where it is for when you need it.