Microsoft Power BI Complete Reference
上QQ阅读APP看书,第一时间看更新

Profit Margin

Now it's time to create the Profit Margin calculation (the profit margin is simply profit divided by sales). For this measure, you are going to use the DIVIDE function. The DIVIDE function is recommended over the divide operator (/) because the DIVIDE function automatically handles divide by zero occurrences. In the case of divide by zero occurrences, the DIVIDE function returns blank. 

Create a new measure on the Internet Sales table using the following code:

Profit Margin = DIVIDE([Profit], [Total Sales])

Next, set the formatting as a percentage. From the modeling ribbon, click on the % icon, as shown in the following screenshot:

Figure 12-Setting formatting as a percentage