Stop 08 · Filter Context & CALCULATETopics · 5/9

ALL, ALLEXCEPT and REMOVEFILTERS

Part of the Power BI Roadmap

In short

To show what share each category is of the total, you need the total, even on a row that's filtered to one category. These three functions remove filters so you can see the bigger picture.

These functions remove filters. ALL clears filters from a table or columns, ALLEXCEPT clears all but the listed columns, and REMOVEFILTERS is a clearer name for removing filters inside CALCULATE.

The jaadu stands on a giant paper map pulling back a huge magnifying glass to reveal the whole city around one pinned lane.

Think of it like this

Zooming out on a map

You're zoomed into one lane in Jaipur. To see how big that lane is compared with the city, you zoom out. REMOVEFILTERS zooms out completely. ALLEXCEPT zooms out but keeps one pin, like the city, so you see the whole city and not the whole country.

Watch it happen

Which filters survive?

Cell: Snacks, Chips, April
REMOVEFILTERS ( 'Product' )
ALLEXCEPT ( 'Product', 'Product'[Category] )
April only
Snacks + April

1/3The cell is filtered to Category Snacks, Subcategory Chips and Month April.

The big ideas

What you need to know

REMOVEFILTERS

Clears filters from a table or columns inside CALCULATE. Its name says exactly what it does.

ALL

Does the same as a CALCULATE argument, and can also be used as a table function returning every row, ignoring filters.

ALLEXCEPT

Clears all filters on a table except the columns you list, like keeping Category while clearing everything else on Product.

Only what you name

Removing filters from Product doesn't touch filters on Date or Store.

See it in code

Walk through the code

dax
1All Products Sales =2CALCULATE ( [Total Sales], REMOVEFILTERS ( 'Product' ) )3 4Category Sales =5CALCULATE ( [Total Sales], ALLEXCEPT ( 'Product', 'Product'[Category] ) )6 7All Cities Sales =8CALCULATE ( [Total Sales], ALL ( Store[City] ) )9 10Product Count Ignoring Filters =11COUNTROWS ( ALL ( 'Product' ) )

1/4Every row shows April sales of all products. The month filter is untouched.

In a matrix of Category and Subcategory, filtered to April by a slicer, see how each measure changes per row.

Save yourself the pain

Common mistakes

Oops

Expecting REMOVEFILTERS ( 'Product' ) to also clear the date slicer.

Do this instead

It only clears Product filters. Name 'Date' too if you want to ignore it.

Oops

Using REMOVEFILTERS ( 'Product' ) when a Product slicer should still count.

Do this instead

It clears slicer filters on Product too. Use ALLSELECTED ( 'Product' ) to keep what the user selected.

Your mission

Zoom out three ways

~20 min

Quick check

CALCULATE ( [Total Sales], REMOVEFILTERS ( 'Product' ) ) with a Month slicer set to April returns:

Go deeper

  1. 1Build a % of Grand Total measure with REMOVEFILTERS.
  2. 2Build a % of Category measure by removing only the product name filter.
  3. 3Check both measures in a matrix with category and product rows.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge