Calculating Percent Profit Margins Using DAX In Power BI (2024)

Working out your profit margins in Power BI with a basic data set can seem like it requires a few steps. You may watch the full video of this tutorial at the bottom of this blog.

Maybe you think you need to use calculated columns to get the result.

Well, you certainly don’t need to do that. There is a much simpler way.

Using measures, you can start with simple information like price and costs, and then via ‘measure branching’, you can work your way up to a profit margin figure that can be filtered by anything in your data model.

This is what we’re going to focus on in this article. After reading this post, you will surely be amazed by how useful this simple process can be in your reports.

Table of Contents

Calculating Percent Profit Margins In Power BI

Before we actually start working out our profit margins, let us have a quick look at our underlying sales table so that we know what we are working on.

As you can see, we have the order quantity, the unit price, total unit cost and total revenue.

Calculating Percent Profit Margins Using DAX In Power BI (1)

With these, we can create our simple measures that will eventually enable us to calculate our percent profit margins.

So let’s dive into the process.

1. Total Sales Measure

The first thing we need to do, obviously, is to create a simple measure. In this particular example, let’s work out the total sales which is a sum of the total revenue column.

Calculating Percent Profit Margins Using DAX In Power BI (2)

2. Calculating Total Costs Using Iterating Function

Since we need to know what our total profits are, the next thing we need to find out is the total costs. We can do this by using an iterating function.

We don’t have a total cost column in this case so we’re going to use SUMX to compute total cost.

Using SUMX, we’ll go to the sales table and multiply the unit cost by the sales quantity for every single row in that table.

Calculating Percent Profit Margins Using DAX In Power BI (3)

Let us first double check our total costs formula before moving on to the next step.

So let’s create a table using our measures.

We’ll bring in our date, total sales for every single day, and total cost for every single day.

This is the table that we’ll be able to create.

Calculating Percent Profit Margins Using DAX In Power BI (4)

3. Total Profits Measure

Now that we have our total sales and total costs measures, we can now calculate our total profits. To get this, of course, we simply subtract total costs from the total sales.

Calculating Percent Profit Margins Using DAX In Power BI (5)

We’ll just drag total profits measure into our table and then we get a total profits column.

Calculating Percent Profit Margins Using DAX In Power BI (6)

4. Calculating Margins

We can very easily calculate our margins after those first three simple steps. And of course, there is definitely no need to go back to our data table and add any columns.

What we need to do, again, is to simply create a new measure.

Let us call this % profit margins.

For the formula, we’re going to use DIVIDE, total profits by total sales, and then put in zero as the alternative result.

Calculating Percent Profit Margins Using DAX In Power BI (7)

Let us then drag this measure into our table to see our profit margins per day.

Calculating Percent Profit Margins Using DAX In Power BI (8)

So we’re able to work out our percent profit margins using measures.

This is a very simple and quick process but the output undoubtedly has many uses.

Uses Of Percent Profit Margins Calculation

Let us now look at the different ways that we can use percent profit margins in Power BI reports.

1. Profit Margin Per Customer

First, we can look at the profit margin per customer.

We’re going to drag in profit margin then add the customer names.

We now have a table that shows the profit margin per customer.

Calculating Percent Profit Margins Using DAX In Power BI (9)

If you need a visualization, of course that’s also possible and you can convert the table into a visual very easily.

Calculating Percent Profit Margins Using DAX In Power BI (10)

2. Profit Margins Over Time

We can also look at our profit margins over a time period.

What we can do is just copy and paste the table with the percent profit margin per day.

Calculating Percent Profit Margins Using DAX In Power BI (11)

Then we can convert this table into a line graph.

Calculating Percent Profit Margins Using DAX In Power BI (12)

Now we have a visual that shows the percent profit margins over time.

Calculating Percent Profit Margins Using DAX In Power BI (13)

3. Comparing Margins Per Product

Using our percent profit measure, we can also see what is our highest and lowest margin products.

Let’s copy and paste our visualization with profit margin and customer names.

Calculating Percent Profit Margins Using DAX In Power BI (14)

Then we’re going to add product name and then turn on data labels.

Calculating Percent Profit Margins Using DAX In Power BI (15)

Now we can compare profit margins by product with Product 14 as the highest and Product 13 as the lowest.

Calculating Percent Profit Margins Using DAX In Power BI (16)

4. Looking At Margins Dynamically

With all the visualizations that we have created, we can look at our margins dynamically.

If we click into our Product 14, for example, we can see how things have tracked over time dynamically for this specific product as shown in the visual number 3.

We can also see how much of the profit margin per customer is product 14 in the first visualization.

Then the visualizations will show the different margins as we click on the different products.

Calculating Percent Profit Margins Using DAX In Power BI (17)

***** Related Links*****
Develop Advanced Scenario Analysis Models Using DAX in Power BI
Are Margins Expanding Or Contracting? Solve in Power BI
Analyze Margin Changes Overtime – Analytics with Power BI and DAX

Conclusion

In this post, we have seen how to work out our profit margins in Power BI using measures.

The key takeaway here is not actually how to exactly work out profit margins, but about how we get there.

The layering of measures on top of each other allows you to create these branches. They can produce quite complex results, but your formulas remain relatively simple as you step through to the end number.

There are so many ways you can use this – not only with the profit margin number, but also with aspects like percentage growth, time comparison results, and much more.

Starting with your simple core measures is certainly the best way to develop your models. It makes bringing in more advanced techniques like time intelligence and scenarios analysis that much easier.

Thanks for reading this article. If you’re interested in learning some more about profit margins, you can check out this post.

Calculating How Much Profit We May Be Losing Out On – Power BI Analytics

Cheers,

Sam

[youtube https://www.youtube.com/watch?v=5rNulK-uvug&w=784&h=441]

Calculating Percent Profit Margins Using DAX In Power BI (2024)

FAQs

How do you calculate profit using dax in Power BI? ›

For the formula, we're going to use DIVIDE, total profits by total sales, and then put in zero as the alternative result. Let us then drag this measure into our table to see our profit margins per day. So we're able to work out our percent profit margins using measures.

How do you calculate 100% profit margin? ›

((Revenue - Cost) / Revenue) * 100 = % Profit Margin

The higher the price and the lower the cost, the higher the Profit Margin. In any case, your Profit Margin can never exceed 100 percent, which only happens if you're able to sell something that cost you nothing.

How do I calculate profit margin percentage? ›

To determine the net profit margin, we need to divide the net income (or net profit) by the total revenue for the year and then multiply by 100. To determine the operating profit margin, we need to divide the operating income or operating profit by the company's total revenue and then multiply by 100.

How to calculate percentage margins? ›

Generally speaking, a good profit margin is 10 percent but can vary across industries. To determine gross profit margin, divide the gross profit by the total revenue for the year and then multiply by 100. To determine net profit margin, divide the net income by the total revenue for the year and then multiply by 100.

What is DAX calculation? ›

Data Analysis Expressions, or DAX for short, are expressions and formulas for analyzing and calculating data. Expressions like this are made up of various parts, such as functions, operators, and constants, all combined into a single formula and evaluated to provide a result (value or values).

What does calculate in DAX do? ›

CALCULATE evaluates all the explicit filter arguments in the original evaluation context, each one independently from the others. This includes both the original row contexts (if any) and the original filter context. Once this evaluation is finished, CALCULATE starts building the new filter context.

How to use all functions in DAX? ›

ALL() can only be used to clear filters but not to return a table. Removes all filters from the specified table. In effect, ALL(Table) returns all of the values in the table, removing any filters from the context that otherwise might have been applied.

What is the formula for profit margin example? ›

If we divide each net income figure by the revenue amount, we arrive at the net profit margin for all three companies. For instance, if we divide Company A's net income by its revenue, we get the following: Net Profit Margin = $7m ÷ $100m =. 07, or 7.0%

How do you calculate 75% profit margin? ›

To calculate profit margin, start with your gross profit, which is the difference between revenue and COGS. Then, find the percentage of the revenue that is the gross profit. To find this, divide your gross profit by revenue. Multiply the total by 100 and voila—you have your margin percentage.

How do you calculate 70% profit margin? ›

How to Calculate Profit Margin
  1. Identify your sale price (or revenue) ($30)
  2. Identify your cost ($9)
  3. Calculate your net profit by subtracting cost from price ($30 - $9 = $21)
  4. Take your net profit and divide it by your price ($21 / $30 = . ...
  5. Multiply your net profit by 100 (. 7 * 100 = 70%)
  6. Your profit margin is 70%

How do you calculate a 25% profit margin? ›

For example, if a product costs $100, the selling price with a 25% markup would be $125: Gross Profit Margin = Sales Price – Unit Cost = $125 – $100 = $25. Markup Percentage = Gross Profit Margin/Unit Cost = $25/$100 = 25%. Sales Price = Cost X Markup Percentage + Cost = $100 X 25% + $100 = $125.

Top Articles
Latest Posts
Article information

Author: Francesca Jacobs Ret

Last Updated:

Views: 5982

Rating: 4.8 / 5 (48 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Francesca Jacobs Ret

Birthday: 1996-12-09

Address: Apt. 141 1406 Mitch Summit, New Teganshire, UT 82655-0699

Phone: +2296092334654

Job: Technology Architect

Hobby: Snowboarding, Scouting, Foreign language learning, Dowsing, Baton twirling, Sculpting, Cabaret

Introduction: My name is Francesca Jacobs Ret, I am a innocent, super, beautiful, charming, lucky, gentle, clever person who loves writing and wants to share my knowledge and understanding with you.