How to Calculate Percentage in Power BI DAX

Cody Schneider••7 min read

Calculating a percentage is a fundamental part of data analysis, but it can get surprisingly tricky when you start working with DAX in Power BI. Understanding how to calculate a percentage of a total is essential for creating meaningful reports that provide context, not just raw numbers. This guide will walk you through the core concepts and provide clear, step-by-step examples for calculating percentages in your Power BI reports.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Why Percentages Are So Important in Reporting

Imagine you're looking at a sales report and see that the "Electronics" category generated $500,000 in revenue. Is that good? It's impossible to know without context. But if you see "$500,000 (which is 45% of total revenue)," you instantly have a valuable insight. That single percentage tells you that Electronics is a dominant category driving nearly half of your business.

Percentages turn raw data into actionable information by helping you understand:

  • Contribution: What portion of the whole does a specific segment represent (e.g., sales from one region vs. total sales)?
  • Proportion: How are resources or results distributed among different categories (e.g., marketing budget spend per channel)?
  • Performance Against a Goal: How close are you to an objective (e.g., 75% of the quarterly sales target)?

In Power BI, this is all accomplished with DAX (Data Analysis Expressions), and while the syntax can look intimidating at first, it all boils down to a simple formula: part / whole.

The Key DAX Functions You Need to Know

To calculate a percentage in DAX, you're essentially performing that "part / whole" division. The challenge is telling Power BI what the "whole" is, especially when filters and slicers are involved. Let's meet the key functions that will do the heavy lifting.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

The DIVIDE Function

Your first instinct might be to use the forward slash (/) for division, but it's much safer to use the DIVIDE() function. Why? Because it automatically handles division by zero errors.

If your denominator (the "whole") is zero or blank, using a slash will break your visual and display an ugly error message. The DIVIDE() function, on the other hand, will gracefully return a blank or an alternate result that you can specify.

The syntax is: DIVIDE(numerator, denominator, [alternate_result])

The CALCULATE Function

CALCULATE() is arguably the most powerful function in DAX. Its main job is to modify the "filter context" of a calculation. In simple terms, it lets you change the environment in which your formula is evaluated. For calculating percentages, we'll use it to remove filters from our denominator, so we can calculate the "grand total" regardless of how the data is being sliced.

The 'ALL' Family of Functions

These functions are used within CALCULATE() to modify the filter context. They are the key to defining the "whole" part of your percentage calculation.

  • ALL(): This is the most common one you'll use. It removes all filters from a table or specific columns. When you're calculating a percentage of a grand total, ALL() tells Power BI to ignore any row-level filters and look at the entire data set for your denominator.
  • ALLSELECTED(): This function is a bit more nuanced. It removes filters from the current visual but respects filters coming from outside the visual (like slicers or other charts). This is useful when you want to show the percentage of a total that has already been filtered by the user.
  • ALLEXCEPT(): This function removes all filters from a table except the filters on the columns you specify. This is perfect for calculating a percentage of a sub-total, like "product sales as a percentage of its category's total sales."

Step-by-Step: Creating Your First Percentage Measure

Let's use a common business scenario to build these measures. Imagine we have a Sales table with columns for Region, Product Category, and Revenue.

First, we need a base measure to sum up our revenue. This is our numerator, or the "part."

  1. In Power BI Desktop, right-click on your Sales table in the Fields pane and select "New Measure."
  2. In the formula bar, enter this simple DAX formula:

Total Revenue = SUM(Sales[Revenue])

Now, let's create a few different percentage measures.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Example 1: Calculating Percentage of Grand Total

This is the most common use case: showing each category's contribution to the absolute grand total of all sales.

The Goal: Create a measure that shows each Region's revenue as a percentage of the total revenue across all regions.

  1. Create a new measure in the Sales table.
  2. Type the following DAX formula into the formula bar:

% of Grand Total Revenue = DIVIDE( [Total Revenue], CALCULATE( [Total Revenue], ALL(Sales) ) )

  1. With your new measure selected, go to the "Measure tools" tab in the ribbon and change the format from "General" to "Percentage."

How This Formula Works:

  • DIVIDE(...): Safely divides our two parts.
  • [Total Revenue]: Our numerator. In a table visual, this is calculated for each row (e.g., for the "North America" region).
  • CALCULATE([Total Revenue], ALL(Sales)): Our denominator. This is the magic part. We are telling DAX to calculate the [Total Revenue], but first, the ALL(Sales) part removes any filters applied to the Sales table for this specific calculation. This means no matter what row our table is on (North America, Europe, etc.), the denominator is always the grand total of all sales data in the table.

Example 2: Calculating Percentage of a Visible Total (Respecting Slicers)

Sometimes, using ALL() is too broad. What if you want to see the percentage of what's currently visible after a user has applied a filter? For this, we use ALLSELECTED().

The Goal: Let's say a user applies a slicer to only show sales for "North America" and "Europe." We want to see the percentage calculated against the total of those two regions, not the total sales of all time.

  1. Create another new measure in your table.
  2. Enter the following formula:

% of Visible Total = DIVIDE( [Total Revenue], CALCULATE( [Total Revenue], ALLSELECTED(Sales) ) )

How It Differs from ALL():

If you put both % of Grand Total Revenue and % of Visible Total in a table and apply a slicer, you'll see the difference. The ALL() version will still be calculated against the pre-filter grand total, resulting in percentages that don't add up to 100%. The ALLSELECTED() version will update its denominator based on your slicer selections, and its column will always sum to 100%.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Bonus Example: Using Variables for Cleaner DAX

As your formulas get more complex, using variables can make them much cleaner and easier to read. You declare variables with VAR and then use RETURN to specify the final output. Here is how you could rewrite "Percentage of the Grand Total" with variables:

% of Grand Total (VAR) = VAR NumeratorValue = [Total Revenue] VAR DenominatorValue = CALCULATE( [Total Revenue], ALL(Sales) ) RETURN DIVIDE(NumeratorValue, DenominatorValue)

The result is exactly the same, but the logic is much easier to follow, which is a lifesaver when you come back to edit this formula six months later.

Final Thoughts

Calculating percentages in Power BI DAX mostly comes down to understanding how to define your denominator for the "part / whole" equation. By using the safe DIVIDE() function and mastering how CALCULATE() works with the ALL() family of functions, you can create context-rich and dynamic reports that provide real business insights.

While mastering DAX is a valuable skill, sometimes you just need to get quick answers from your data without getting into a filter-context wrestling match. For this reason, we designed Graphed to be your AI data analyst. Instead of writing DAX, you can just connect your data sources - like Google Analytics, Shopify, or Salesforce - and ask questions in plain English, like, "show me revenue by product category as a percentage of total." We handle the complexities in the background to instantly create the charts, reports, and dashboards you need, giving you back the time to focus on strategy instead of syntax.

Related Articles