What is ALLSELECTED in Power BI?

Cody Schneider7 min read

Power BI’s DAX language is filled with powerful functions, but ALLSELECTED can feel a bit tricky when you’re starting out. It sounds similar to ALL, but its behavior is unique and incredibly useful for creating reports that respond dynamically to what your user has selected. This article will break down exactly what ALLSELECTED does, how it differs from ALL, and walk through a practical example to show you how to use it in your own reports.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What is ALLSELECTED? A Clear Explanation

At its core, ALLSELECTED is a DAX function that returns all the rows in a table, or all the values in a column, while ignoring filters applied within the current visual but respecting any filters that come from outside of it.

That might sound a bit abstract, so let's use a better analogy. Imagine you have a big bucket full of different colored Lego bricks (this is your entire dataset).

  • A slicer in Power BI is like having someone tell you, "I only want to see the red and blue bricks." This is an external filter context. You set aside all other colors and only focus on the red and blue ones.
  • A table or matrix visual in your report is like arranging those red and blue bricks into separate piles - one for red, one for blue. This creates an internal filter context. When the table calculates a value for the "red" row, it's only looking at the red bricks.

So, where does ALLSELECTED fit in? When you use ALLSELECTED inside a calculation, it tells Power BI: "For this calculation, ignore the fact that the bricks are separated into red and blue piles (the internal filter) and instead, look at all the bricks the user originally selected (the red and blue ones combined)."

The main purpose of ALLSELECTED is to calculate percentages or ratios based on a user's filtered view, making your reports interactive and intuitive.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

The Critical Difference: ALLSELECTED vs. ALL

This is where most of the confusion happens. ALL and ALLSELECTED are both "filter modifier" functions, but they respect different boundaries. The difference is the key to mastering dynamic reporting.

ALL() ignores all active filters. This includes slicers, page filters, and any filters within the visual itself. It tells Power BI to look at the entire, unfiltered dataset for that calculation. If we go back to our Lego analogy, ALL says, "Forget the request for red and blue bricks. Give me the total number of all bricks in the original bucket, regardless of color."

ALLSELECTED() respects the external filters but ignores the internal visual filters. It says, "Okay, we’re only focused on the red and blue bricks as requested. Now, calculate the total count of all red and blue bricks combined."

When to Use Each Function

Deciding between them depends on what question you want to answer:

  • Use ALL when you need to calculate a percentage against the absolute grand total. For example: "What percentage of our company's total sales came from the Electronics category?"
  • Use ALLSELECTED when you need to calculate a percentage against the user-selected total. For example: "If a user has sliced the report to only show Electronics and Clothing, what percentage of that sliced total came from Electronics?"

Here’s a simple table to summarize the behavior:

How to Use ALLSELECTED: A Practical Example

The most common use for ALLSELECTED is to calculate the "% of visible total." Let’s build that exact scenario step-by-step. Imagine you have a simple Sales table with Product Category and Revenue columns.

Step 1: Create a Basic Sales Measure

First, we need a simple base measure to sum our revenue. This is standard DAX practice and provides a clean foundation.

Total Sales = SUM(Sales[Revenue])

If you put this measure into a table with Product Category, it will show you the total sales for each category.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 2: Create a Measure with ALLSELECTED

Next, we’ll create a measure that calculates the total revenue for everything the user has selected. This measure, when placed in a table, will "break out" of its row's context and show the total for all visible rows.

Here’s the DAX:

Selected Total Sales = CALCULATE( [Total Sales], ALLSELECTED('Sales'[Product Category]) )

Let's break this down:

  • CALCULATE([Total Sales], ...): This tells DAX to calculate our Total Sales measure but with a modified filter context.
  • ALLSELECTED('Sales'[Product Category]): This is the filter modifier. It instructs CALCULATE to remove any filters coming from the Product Category column within the visual, but to respect any filters applied to that column from elsewhere (like a slicer).

Step 3: Build the Percentage Measure

Now we have a measure for the individual category’s sales (Total Sales) and a measure for the selected group's total sales (Selected Total Sales). All we have to do is divide them to get the percentage.

Using the DIVIDE function is a best practice, as it safely handles cases where the denominator might be zero.

% of Total Selected = DIVIDE( [Total Sales], [Selected Total Sales], 0 )

Make sure to set the format for this measure to "Percentage" in Power BI's Measure tools ribbon.

Step 4: Putting it all Together in a Report

Let’s see it in action. Create a report page with:

  1. A slicer for Product Category.
  2. A table visual with Product Category and our three measures: Total Sales, Selected Total Sales, and % of Total Selected.

Scenario 1: No slicer selection (all categories are visible)

With nothing selected in the slicer, ALLSELECTED behaves like ALL. Your table would look something like this:

Notice that Selected Total Sales shows the grand total ($340,000) on every row, and the percentages add up to 100%.

Scenario 2: Slicer selections made

Now, let's say a user clicks on "Electronics" and "Clothing" in the slicer. The report instantly updates. This is where ALLSELECTED shines.

Look at what happened: The table is now filtered to only show two categories. The Selected Total Sales column updated to show their combined total ($150,000 + $100,000 = $250,000). And most importantly, the % of Total Selected now re-calculates to show the share within this new context. Electronics is now 60% of the selected business, making the report far more insightful for the end-user.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Common Mistakes and Best Practices

Understanding the theory is half the battle. Here are a few tips to avoid common pitfalls:

  • Mind Your Context: The magic of ALLSELECTED is entirely dependent on external filters. If you don't have any slicers or filters for the column in question, it will behave just like ALL. Always test your measures with slicers to ensure they work as expected.
  • Be Specific When Possible: While you can use ALLSELECTED(TableName), it’s often better to specify the column ALLSELECTED(Table[Column]). This makes your DAX clearer and ensures you are only removing the filter from the column you intend to.
  • Start with the Intermediate Steps: When building a complex measure, don't just write the final percentage calculation. Build the components like we did above (Total Sales and Selected Total Sales) and add them to your table first. This lets you see what each part of the formula is doing, making troubleshooting much easier.

Final Thoughts

Mastering ALLSELECTED moves you from creating static reports to building genuinely interactive analysis tools. By understanding how it respects external filters while ignoring internal ones, you can deliver precise calculations that adapt dynamically to user curiosity, providing much deeper and more relevant insights.

Learning the intricacies of BI tools like Power BI can be a time-consuming but rewarding process. In our experience, the real barrier often isn’t the complexity of writing code but the time it takes to connect data and manually build each dashboard element. With tools like Graphed , we aim to eliminate that friction by letting you build real-time, interactive dashboards just by describing what you need in plain English. Instead of authoring DAX, you can simply ask, "Show me revenue by product category and the percentage of total for each," and get a live dashboard in seconds.

Related Articles

How to Enable Data Analysis in Excel

Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!