How to Calculate Market Share in Power BI

Cody Schneider8 min read

Calculating your market share is one of the most effective ways to understand your company's position within your industry. This simple percentage tells you how much of the total market you command, putting your own sales figures into a much more meaningful context. This article will walk you through exactly how to calculate market share in Microsoft Power BI, breaking down the essential DAX formulas and report-building process step by step.

Why Does Calculating Market Share Matter?

Before jumping into the formulas, it's important to understand what makes market share such a valuable metric. It’s more than just a number, it’s a benchmark for your performance against competitors.

  • Competitive Benchmarking: Are you a market leader, a rising challenger, or a niche player? Market share gives you a clear answer, helping you see where you stand and who your real competitors are.
  • Tracking Growth: If your sales are growing by 10% but the total market is growing by 30%, you're actually losing ground. Market share helps you track your true growth relative to the industry's pace.
  • Strategic Decision-Making: A clear view of market share can highlight opportunities. Perhaps you see a chance to capture more share in a specific region or product category. Conversely, it can signal a threat if a competitor is rapidly gaining on you.

In short, it provides the context you need to turn raw sales data into actionable business intelligence.

Preparing Your Data for Market Share Analysis

A reliable calculation starts with a well-structured data model. For market share analysis, you typically need at least two tables: a Fact Table containing transactions (like sales) and a Dimension Table containing descriptive attributes (like company or product details).

Let's imagine you have sales data for every company in your market, not just your own. This might come from industry reports, market research data, or an internal database.

Example Data Model

For our example, let's assume we have two tables:

1. A 'Sales' table (our Fact Table): This table contains individual transaction records.

  • Date
  • ProductName
  • Units Sold
  • Revenue

2. A 'Companies' table (our Dimension Table): This table has details about each company's products. It's connected to the 'Sales' table via the ProductName column (a one-to-many relationship).

  • ProductName
  • CompanyName
  • Region

With this model loaded into Power BI and the relationship established, you're ready to start writing some DAX.

The DAX Formulas You'll Need

The magic behind calculating market share in Power BI lies in DAX (Data Analysis Expressions). Don't worry if you're not a DAX expert, we'll break down the key functions you need in simple terms.

The basic formula for market share is:

Market Share = (Your Company's Sales / Total Market Sales)

To calculate this, we need to create DAX measures for both parts of this equation.

Understanding Filter Context and the CALCULATE Function

Before writing the formulas, you must understand a core Power BI concept: filter context. When you put a measure into a table or chart visual, Power BI automatically filters it based on context. For example, if you place a sales measure in a table next to a list of company names, the measure automatically calculates the sales for each specific company in each row.

To get the total market sales, we need to temporarily ignore this filter context. That’s where the CALCULATE and ALL functions come in.

  • CALCULATE() is the most powerful function in DAX. It changes the context in which data is evaluated. We use it to tell our measure, "Calculate this expression, but with a different set of filters."
  • ALL() is a function that returns all the rows in a table or all the values in a column, ignoring any filters that might have been applied. It's the key to getting our "Total Market Sales" figure.

Step-by-Step Guide: Creating Your Market Share Measures

Let's build the measures we need one at a time. In the Power BI ribbon, go to the Modeling tab and click on New Measure for each step.

Step 1: Create a Base Measure for Sales

First, we need a simple measure that calculates the total revenue from our 'Sales' table. This is straightforward.

Total Revenue = SUM(Sales[Revenue])

This measure will form the numerator (Your Company's Sales) of our market share fraction. When you put this in a table broken down by 'CompanyName', it will already show the sales for each individual company due to the filter context.

Step 2: Create a Measure for Total Market Revenue

Next, we need the denominator of our fraction: total sales across all companies, regardless of which company's row we are looking at in a table. This is where we use CALCULATE and ALL.

We'll create a measure that calculates our 'Total Revenue' but removes any filters currently applied to the 'CompanyName' column of our 'Companies' table.

Total Market Revenue = 
CALCULATE(
    [Total Revenue],
    ALL(Companies[CompanyName])
)

Let's break that down:

  • We're telling CALCULATE to use our base [Total Revenue] measure.
  • The second argument, ALL(Companies[CompanyName]), is the filter modifier. It tells Power BI to ignore any filters on the 'CompanyName' column.

When you place this measure in a table next to 'CompanyName', you'll notice it shows the same grand total for every single row. That’s exactly what we want! It has successfully ignored the filter context of each row.

Step 3: Calculate the Market Share Percentage

Now we have both pieces of our equation. The final step is to divide a company's sales by the total market's sales.

We'll use the DIVIDE() function, which is a safe way to perform division because it automatically handles cases where the denominator is zero (preventing errors).

Market Share % = 
DIVIDE(
    [Total Revenue],
    [Total Market Revenue]
)

After creating this measure, make sure to select it in the Fields pane, navigate to the Measure tools tab in the ribbon, and format it as a Percentage. This will make your results much easier to read in your report.

Visualizing Your Market Share in a Power BI Report

With your measures ready, you can now build insightful visuals.

1. Create a Market Share Table

The simplest way to view the results is to create a Table or Matrix visual.

  • Drag the CompanyName column from your 'Companies' table into the visual.
  • Drag your newly created [Market Share %] measure into the visual.

You now have a clear breakdown of each company's market share. You can sort this table to quickly identify the market leaders and smaller players.

2. Use a Donut or Pie Chart for Quick Comparison

For a more visually appealing dashboard, a Donut chart can work well.

  • Add a Donut chart to your report canvas.
  • Drag CompanyName to the Legend field.
  • Drag [Total Revenue] to the Values field.

Power BI will automatically calculate the percentage contributions for you, giving you an instant visual representation of market share.

Advanced Tip: Using Slicers and the ALLSELECTED Function

What if you want your dashboard to be interactive? For example, you add a Slicer visual for 'Region'. When you select a specific region, your market share calculation using ALL will show each company's share of the total global market, not their share of the selected region's market.

This is often not what you want. You want to see who owns the most market share within the selected region. To do this, you need to use a different function: ALLSELECTED().

ALLSELECTED is slightly different from ALL. It removes filters from inside the visual (like columns in a table), but it respects filters coming from outside the visual (like slicers).

Let's create an alternate market share measure:

Market Share % (Selected Context) = 
DIVIDE(
    [Total Revenue],
    CALCULATE([Total Revenue], ALLSELECTED(Companies[CompanyName]))
)

Now, if you build a new table with this measure and filter your report by 'Region', the market share percentages will recalculate to add up to 100% within that region. This simple switch makes your dashboards dramatically more powerful and user-friendly.

Final Thoughts

Calculating market share transforms your Power BI reports from simple sales summaries into powerful strategic tools for competitive analysis. By combining a solid data model with versatile DAX formulas like CALCULATE, ALL, and ALLSELECTED, you can create dynamic dashboards that give you a constant, clear view of your position in the marketplace.

While mastering DAX is a great skill, sometimes you just need insights fast. We built Graphed because we believe getting answers from your data shouldn't require you to be a programmer. We automate the entire process by letting you connect your sources and create reports using simple, natural language. Instead of writing formulas, you could just ask, "Show me a pie chart of our market share by brand for last year," and our AI data analyst builds the real-time visualization for you in seconds.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.