Forum Discussion
Margin % Calculation Column
- 11 years ago
I would not be creating Margin % calc as a column, you should create it as a measure and then you don't have to worry about how Margin % is being aggregated which is what you may be seeing when your numbers are off.
Also, you should use the DIVIDE() function to make sure you don't get affected by zeros
https://msdn.microsoft.com/en-us/library/jj677276.aspx
so the calc should be something like this:
Margin % = DIVIDE(SUM(mytable[revenue]) - Sum(mytable[cost]), Sum(mytable[Revenue]))
That worked like a charm. Now to understand why microsoft recomends columns vs. measures in this capacity?
Thanks much!
// CD
if you are new to modeling with Power BI, you may want to go through this tutorial. If frames up some basic concepts that you may find useful