DAX Filter Functions in Power BI: The Complete Guide

By Vivek Dhumal • 2026-06-25 • 15 min read
DAX Filter Functions in Power BI: The Complete Guide
Key Takeaways
  • Filter functions control which rows get included in a calculation — they're how DAX answers questions like "total sales, but only for last year" or "sales for every region except the one currently selected."
  • CALCULATE is the single most important function in this entire list. Most other filter functions exist to be used inside CALCULATE, modifying what it sees.
  • ALL, ALLEXCEPT, and ALLSELECTED all remove filters, but each one removes a different, specific set of them — mixing these up is one of the most common sources of "why is my percentage-of-total wrong" questions in Power BI.
  • LOOKUPVALUE retrieves a value from another table based on matching conditions, without needing a relationship to already exist between the two tables.
  • This guide splits into two halves: the first covers the core filter functions everyone uses in everyday measures, explained at a true-beginner level. The second half covers a newer family of functions tied to Power BI's "visual calculations" feature — genuinely more advanced, and worth knowing exist even if you don't reach for them often yet.

Filter functions are arguably the part of DAX with the steepest learning curve, mostly because they don't calculate numbers directly — they calculate which numbers get included in a calculation that happens elsewhere. That's a more abstract job than addition or multiplication, and it's exactly why this category trips people up more than the aggregation or date functions ever do. This guide goes through all 30, building from the everyday essentials up to the genuinely advanced.

What Do Filter Functions Actually Do?

Every measure you write in DAX is being calculated inside some set of currently active filters — what report page someone's on, what slicer they've clicked, what row of a table visual they're looking at. This active set of filters is called the filter context, and filter functions are the tools that let you reach into that context and deliberately change it: removing a filter, adding a new one, or asking what the filter context looked like before some other filter got applied.

The single most important function in this entire category, by a wide margin, is CALCULATE. A large share of the other filter functions exist specifically to be used as ingredients inside a CALCULATE call, rather than being used entirely on their own. Once CALCULATE makes sense, most of the rest of this list becomes a question of "which specific filter behavior do I need here," rather than learning something brand new each time.

The Sample Data Used Throughout This Guide

Every core example below pulls from the same small Sales table — twelve orders, spread across four regions, two categories, and two years.

OrderID Region Category Year Sales
1 North Electronics 2025 10,000
2 North Furniture 2025 4,000
3 South Electronics 2025 8,000
4 South Furniture 2025 6,000
5 East Electronics 2025 12,000
6 East Furniture 2025 3,000
7 West Electronics 2026 15,000
8 West Furniture 2026 5,000
9 North Electronics 2026 9,000
10 South Electronics 2026 7,000
11 East Furniture 2026 11,000
12 West Furniture 2026 4,500

The grand total across every row is 94,500. Keep that number in mind — you'll see several functions below either preserve it, ignore it, or partially restore it, depending on exactly what each one is built to do.


Part One: The Core Filter Functions

This first group covers the functions you'll genuinely use in everyday report-building. We'll go through them carefully, building on each other.

CALCULATE: The Function Everything Else Supports

CALCULATE evaluates an expression inside a modified filter context — it's how you tell DAX to calculate something under a different set of filters than whatever's currently active.

Total Sales = SUM(Sales[Sales])
Sales North Only = CALCULATE([Total Sales], Sales[Region] = "North")

Without any filter applied, Total Sales returns the full 94,500. But Sales North Only takes that same measure and recalculates it under an added filter restricting things to just the North region, returning 23,000 instead — the sum of just Order 1, Order 2, and Order 9. Notice the formula for Total Sales itself never changed. CALCULATE simply changed the conditions it was evaluated under.

This pattern — take an existing measure, recalculate it under a modified filter — is the foundation for an enormous share of real-world DAX work. Year-over-year comparisons, "this category vs. all categories," top-N analysis — nearly all of it eventually routes through CALCULATE.

CALCULATETABLE: The Same Idea, Returning a Table Instead of a Number

CALCULATETABLE works exactly like CALCULATE, but instead of returning a single calculated value, it returns an entire table, evaluated under the modified filter conditions.

North Orders = CALCULATETABLE(Sales, Sales[Region] = "North")

Where CALCULATE would give you back one number (like a total), CALCULATETABLE gives you back the rows themselves — in this case, the three rows belonging to the North region. You'd reach for this when you need to do something with a filtered set of rows, like feeding them into another table function, rather than needing a single aggregated number.

FILTER: Building a Custom Condition

FILTER returns a table containing only the rows that meet a condition you specify — it's the function you reach for when a simple equals-this-value filter isn't flexible enough.

High Value Orders = FILTER(Sales, Sales[Sales] > 8000)

This returns every row where Sales is greater than 8,000 — Orders 1, 5, 7, 9, and 11, going by the table above. FILTER is most commonly used inside CALCULATE, when the condition you need is more complex than CALCULATE can express directly on its own:

High Value Total = CALCULATE([Total Sales], FILTER(Sales, Sales[Sales] > 8000))

This combination returns 57,000 — the total of just those five high-value orders.

ALL: Removing Filters Entirely

ALL removes filters from a column or table, returning every row regardless of whatever filters are currently active elsewhere in the report.

This is the function behind almost every "percent of total" calculation you'll ever build. Imagine you're looking at the North region specifically (so the filter context is currently restricted to North), and you want to show what percentage of the grand total that represents:

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

Inside the North filter context, [Total Sales] returns 23,000. But ALL(Sales) tells CALCULATE to ignore the region filter entirely for that one specific calculation, so the denominator becomes the full 94,500 regardless of what's currently filtered. The result: North represents roughly 24.3% of total sales — a number that only makes sense because ALL deliberately stepped outside the filter that was otherwise narrowing things down.

ALLEXCEPT: Removing Most Filters, But Not All of Them

ALLEXCEPT removes every filter from a table except for the specific column or columns you name — the opposite framing of telling DAX exactly what to remove.

Sales Ignoring Category = CALCULATE([Total Sales], ALLEXCEPT(Sales, Sales[Region]))

This removes every filter currently active on the Sales table except whatever's filtering the Region column. So if a report is currently filtered to North and Electronics, this formula would still respect the North filter, but would ignore the Electronics filter, returning the total for all of North regardless of category — 23,000 in this case, the same as plain [Total Sales] filtered to North alone, since region was the only filter being preserved.

The difference between ALL and ALLEXCEPT trips a lot of people up at first: ALL says "ignore everything." ALLEXCEPT says "ignore everything except this one thing I'm naming."

ALLSELECTED: Respecting What the User Picked, Ignoring What the Formula Added

ALLSELECTED removes filters that came from inside the current formula's own calculation, while still respecting filters the user explicitly applied through slicers or visual selections.

This one is genuinely subtle, and it exists to solve a specific problem: sometimes you want a "percent of total" calculation that respects a user's slicer choice (say, they've filtered to just 2026) but still treats the visual itself as the boundary for "total," rather than going all the way back to the full unfiltered dataset the way ALL would.

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

If a user has filtered the whole report to 2026 using a slicer, ALLSELECTED would respect that 2026 boundary (since the user explicitly chose it), but ignore any further breakdown happening inside the visual itself, like Region appearing as rows in a table. ALL, by contrast, would blow past the 2026 slicer filter too, going all the way back to the full 94,500 regardless of what the user selected. Getting this distinction right is exactly what separates a percentage that behaves the way users expect from one that confusingly changes when they apply a slicer.

ALLNOBLANKROW: Like ALL, But Without a Hidden Extra Row

ALLNOBLANKROW works like ALL, removing filters from a table or column, but specifically excludes the automatic blank row that Power BI sometimes adds when a relationship has unmatched rows.

In certain data model setups — particularly when a relationship isn't perfectly clean — Power BI silently adds an extra blank row to represent unmatched data, which can quietly throw off counts and totals if you're not expecting it. ALLNOBLANKROW does the same filter-clearing job as ALL, but deliberately leaves that automatic blank row out of the result. You won't need this often, but it's worth knowing it exists for situations where your numbers are slightly higher than expected and an unexpected blank row turns out to be the cause.

ALLCROSSFILTERED: Clearing Filters That Arrived Through a Relationship

ALLCROSSFILTERED removes filters on a table that arrived indirectly, through a relationship with another table, rather than filters applied directly.

This is a more specialized cousin of ALL, useful in models with more complex relationship structures, where a filter on one table is cross-filtering into another table through a relationship, and you specifically want to clear that cross-filtering effect while leaving other filters intact. It's not a function you'll reach for in everyday beginner-level report building, but it's worth recognizing the name if you encounter it in someone else's formula.

KEEPFILTERS: Adding a Filter Without Replacing What's Already There

KEEPFILTERS changes how a filter argument inside CALCULATE combines with filters that already exist, making it add on top of the existing filter instead of replacing it.

By default, when you write a filter condition inside CALCULATE, it overwrites any existing filter on that same column, rather than combining with it. KEEPFILTERS changes that default behavior:

Sales North And Filtered = CALCULATE([Total Sales], KEEPFILTERS(Sales[Region] = "North"))

If a report is already filtered to, say, North and South together (through some other filter), a plain CALCULATE(..., Sales[Region] = "North") would simply replace that with North alone. Adding KEEPFILTERS instead makes the new North condition combine with the existing filter — meaning if the existing filter didn't already include North at all, the result would actually return blank, since there's no overlap between the two conditions. This is a genuinely subtle function, and you'll mostly encounter the need for it once you start writing more layered measures that need to interact carefully with filters already present elsewhere in a report.

REMOVEFILTERS: A Clearer Way to Say "Ignore This Filter"

REMOVEFILTERS removes filters from one or more specified tables or columns — functioning as a clearer, more explicitly-named alternative to using ALL inside CALCULATE.

Sales Ignoring Region = CALCULATE([Total Sales], REMOVEFILTERS(Sales[Region]))

This returns the same kind of result you'd get from using ALL(Sales[Region]) inside CALCULATE — the region filter gets cleared, while other filters remain untouched. Microsoft introduced REMOVEFILTERS partly because ALL was being used for two different jobs (clearing filters, and separately, returning an unfiltered table on its own), and having a name that says exactly what it does inside CALCULATE makes formulas easier to read at a glance.

LOOKUPVALUE: Pulling a Value From Another Table Without Needing a Relationship

LOOKUPVALUE retrieves a value from another table by matching one or more conditions, and critically, it doesn't require a relationship to already exist between the two tables.

Region Manager = LOOKUPVALUE(Managers[ManagerName], Managers[Region], Sales[Region])

This looks up the matching manager name from a separate Managers table, based on matching the Region column between the two tables — even if no formal relationship has been built connecting Sales and Managers in the model. This is genuinely useful in situations where building a full relationship isn't practical or desired, but you still need to pull in a related value from somewhere else.

LOOKUP: A More General Version of LOOKUPVALUE

LOOKUP performs a similar matching job to LOOKUPVALUE, but returns an entire row of matching values rather than being limited to retrieving a single column.

The distinction between LOOKUP and LOOKUPVALUE is subtle enough that LOOKUPVALUE covers the vast majority of real-world use cases on its own; LOOKUP exists for less common situations needing to retrieve multiple matched values from a row at once, rather than one specific column.

LOOKUPWITHTOTALS: Lookup Behavior That Plays Well With Subtotals

LOOKUPWITHTOTALS performs a similar lookup operation, but is specifically designed to behave correctly when used inside a visual that includes subtotal or grand total rows.

A plain LOOKUPVALUE can sometimes behave unexpectedly on a subtotal row, since there isn't one single matching value to return when multiple underlying rows are being summarized together. LOOKUPWITHTOTALS is built to handle that situation more gracefully, which matters specifically in matrix visuals with subtotals turned on.

EARLIER and EARLIEST: Reaching Back to an Outer Row

EARLIER returns the value of a column from an outer row context, used specifically when a calculated column's formula creates a nested loop through the same table. EARLIEST does the same job, but always reaches all the way back to the very first, outermost row context, rather than letting you step back by a specific number of levels the way EARLIER can.

These two functions are genuinely confusing at first, and the confusing part isn't really the function itself — it's the situation that requires it. Picture a calculated column that ranks rows by comparing each row's Sales value against every other row in the table:

Sales Rank = COUNTROWS(FILTER(Sales, Sales[Sales] > EARLIER(Sales[Sales]))) + 1

Here's what's happening: FILTER creates its own fresh row context as it scans through the table, which would normally make the original row you started from invisible inside that inner loop. EARLIER solves exactly this problem — it reaches back to that outer, original row's Sales value, even while you're nested inside FILTER's own separate row-by-row scan.

One detail worth knowing explicitly: EARLIER and EARLIEST are built around row context, which exists in calculated columns but not in measures. Try using either function inside a regular measure, and it will return an error, since there's no outer row to reach back to in the first place. In modern DAX, most people accomplish the same result shown above using a VAR (variable) to store the current row's value instead, which most practitioners find easier to read — but EARLIER and EARLIEST still show up often enough in older or community-shared formulas that it's worth recognizing what they do.

FIRSTNONBLANK, FIRSTNONBLANKVALUE, LASTNONBLANK, and LASTNONBLANKVALUE

These four work in closely related pairs, and the naming is genuinely the trickiest part.

FIRSTNONBLANK returns the first value in a column, in sort order, for which a specified expression doesn't evaluate to blank.

LASTNONBLANK does the identical job, but returns the last such value instead of the first.

First Active Year = FIRSTNONBLANK(Sales[Year], CALCULATE(COUNTROWS(Sales)))

This scans through the Year column in order, and returns the first year for which there's at least one matching row — in this dataset, that's 2025, since it's the earliest year present with actual sales activity.

FIRSTNONBLANKVALUE and LASTNONBLANKVALUE work similarly, but instead of returning the value from the lookup column itself, they return the result of a separate expression, evaluated at whichever row turned out to be the first (or last) non-blank one. These two are most commonly used in inventory and balance-style calculations — for example, finding the very first or very last recorded stock level for a product, rather than just identifying which date that occurred on.


Part Two: Window and Visual Calculation Functions (Advanced)

Here's an honest shift in altitude: everything in Part One is something you'll use in regular, everyday measures. Everything from here on is part of a newer, more advanced corner of DAX, tied specifically to a feature called visual calculations — a way of writing DAX directly on a visual rather than inside the data model itself — along with the underlying window functions that visual calculations are built on top of. If you're brand new to DAX, it's completely fine to bookmark this section and come back to it once CALCULATE and filter context genuinely feel comfortable. If you've got that foundation already, this section assumes it.

Why This Group Is Different

Visual calculations live directly on a chart or table visual, rather than being stored permanently in your data model the way a regular measure is. They were built specifically to make calculations like running totals and moving averages dramatically easier to write than they'd otherwise be using traditional DAX. Several functions in this group — RUNNINGSUM, MOVINGAVERAGE, RANK, and ROWNUMBER — are specifically described by Microsoft as visual-calculation-only shortcuts, built on top of three more flexible underlying functions: INDEX, OFFSET, and WINDOW.

INDEX, OFFSET, and WINDOW: The Underlying Window Functions

INDEX retrieves a single row at a specific position within a sorted, partitioned table — first, second, last, and so on. A common use is finding a top performer: sort a table by sales descending, then use INDEX(1, ...) to grab whichever row lands in first place.

OFFSET retrieves a single row positioned relative to the current row — for example, "the row right before this one," which is exactly the kind of calculation needed to compare this month's value against last month's, row by row, inside a visual.

WINDOW is the most flexible of the three, returning a whole range of rows rather than just one — defined by a starting and ending position, either as exact row numbers or as positions relative to the current row. It's the engine underneath calculations like a rolling 7-day or 3-month average.

RunningSum = SUMX(WINDOW(1, ABS, 0, REL, ALLSELECTED('Date'[Month])), [Total Sales])

This example sorts through months and accumulates sales from the very first month (position 1, absolute) through the current row (position 0, relative), which is precisely what a running total is doing under the hood. Genuinely powerful, but also genuinely more involved than anything in Part One — this is the kind of formula most people don't write from scratch until they've spent real time with DAX first.

ORDERBY and PARTITIONBY: Setting Up How a Window Is Organized

ORDERBY specifies the sort order used when INDEX, OFFSET, or WINDOW determine row positions — without it, "the first row" or "the previous row" wouldn't have a defined meaning.

PARTITIONBY splits a table into separate groups before a window function operates, so that positions like "first row" or "previous row" are calculated separately within each group, rather than across the whole table at once.

WINDOW(-2, REL, 0, REL, Sales, ORDERBY(Sales[Year]), PARTITIONBY(Sales[Region]))

Here, PARTITIONBY ensures each region gets its own independent window, and ORDERBY ensures rows within each region's window are processed in year order — together, these two functions are what make a window calculation behave sensibly across grouped data, rather than treating the whole table as one undivided sequence.

MATCHBY: Fine-Tuning Which Columns Identify a Row

MATCHBY specifies which columns should be used to uniquely identify each row inside a window function, used in situations where the default column-matching behavior needs to be made explicit.

This is a genuinely niche, advanced parameter that most window-function formulas don't need to specify directly, since DAX usually infers the right columns automatically. It exists mainly for edge cases in more complex models where that automatic inference needs a manual nudge.

RANGE: A Simpler Way to Build a Date-Based Table

RANGE returns a table of dates between a start and end value, used as a lighter-weight alternative to building a full calendar table for certain window-function and visual-calculation scenarios.

It's narrower in purpose than CALENDAR, mainly showing up as a convenient input table specifically inside window-function-style calculations rather than as a general-purpose date-table builder for your whole model.

RUNNINGSUM: A Running Total, Without Writing a Window Function by Hand

RUNNINGSUM calculates a running total along a visual, adding each value to everything that came before it — and it's specifically built as a shortcut for the equivalent, more complex WINDOW-based formula.

Sales Running Total = RUNNINGSUM([Total Sales])

Used directly inside a visual calculation, this produces a self-accumulating total down a table or matrix, without you needing to construct the underlying WINDOW expression by hand. This is precisely the kind of calculation that used to require fairly involved DAX, and now takes one function call once you're working inside the visual calculations feature.

MOVINGAVERAGE: A Rolling Average, the Same Way

MOVINGAVERAGE calculates the average of values over a specified window size along a visual, again acting as a shortcut for the equivalent window-function formula.

Sales 3 Month Avg = MOVINGAVERAGE([Total Sales], 3)

This produces a rolling 3-period average, recalculating as it moves down the visual — the kind of smoothing calculation commonly used to make a noisy month-to-month trend line easier to read.

RANK and ROWNUMBER: Ordering Rows Inside a Visual

RANK assigns a rank position to each row of a visual based on a specified value, while ROWNUMBER simply numbers the rows in sequence, regardless of their underlying values.

The distinction matters: RANK reflects the actual values being compared (so tied values can share a rank), while ROWNUMBER just counts position regardless of whether two rows happen to hold the same value. Both are visual-calculation functions, used to add ordering information directly onto a visual without needing a separate calculated column built into the model beforehand.

SELECTEDVALUE: Returning a Single Selected Value, Safely

SELECTEDVALUE returns a single value from a column when exactly one value is currently selected or filtered, and returns a fallback value (or blank) otherwise.

This one is genuinely useful in everyday work too, not just advanced scenarios — it commonly shows up displaying a slicer's current selection in a card visual or report title:

Selected Region = SELECTEDVALUE(Sales[Region], "Multiple Regions Selected")

If exactly one region is currently selected, this returns that region's name. If multiple regions are selected at once (or none at all), it falls back to the text provided as the second argument instead of returning an error or a confusing blank.


Quick-Reference Table of All 30 Functions

Function What it does Difficulty
CALCULATE Evaluates an expression under modified filters Core
CALCULATETABLE Same as CALCULATE, but returns a table Core
FILTER Returns rows matching a custom condition Core
ALL Removes all filters from a column or table Core
ALLEXCEPT Removes all filters except specified columns Core
ALLSELECTED Removes formula-added filters, keeps user selections Core
ALLNOBLANKROW Like ALL, excluding the automatic blank row Core
ALLCROSSFILTERED Removes filters arriving through a relationship Core
KEEPFILTERS Adds a filter instead of replacing an existing one Core
REMOVEFILTERS Clearly named alternative to ALL inside CALCULATE Core
LOOKUPVALUE Looks up a value by matching conditions, no relationship needed Core
LOOKUP Like LOOKUPVALUE, returns a full row Core
LOOKUPWITHTOTALS Lookup that behaves correctly with subtotal rows Core
EARLIER Reaches back to an outer row context, N steps Core
EARLIEST Reaches back to the very first outer row context Core
FIRSTNONBLANK First value in a column with a non-blank result Core
FIRSTNONBLANKVALUE Value of an expression at the first non-blank row Core
LASTNONBLANK Last value in a column with a non-blank result Core
LASTNONBLANKVALUE Value of an expression at the last non-blank row Core
SELECTEDVALUE Returns one value if exactly one is selected Core
INDEX Retrieves a row at a specific position Advanced
OFFSET Retrieves a row relative to the current row Advanced
WINDOW Retrieves a range of rows around the current row Advanced
ORDERBY Sets sort order for a window function Advanced
PARTITIONBY Splits a table into groups for a window function Advanced
MATCHBY Specifies row-identifying columns for a window function Advanced
RANGE Builds a lightweight date table for window scenarios Advanced
RUNNINGSUM Running total shortcut for visual calculations Advanced
MOVINGAVERAGE Rolling average shortcut for visual calculations Advanced
RANK / ROWNUMBER Ranks or numbers rows within a visual Advanced

Common Mistakes Worth Knowing About Early

  • Confusing ALL with ALLSELECTED. ALL ignores every filter, including ones the user deliberately applied through a slicer. ALLSELECTED respects what the user picked, while ignoring filters added internally by the formula itself. Using the wrong one is the single most common reason a "percent of total" measure behaves unexpectedly when someone applies a slicer.
  • Trying to use EARLIER inside a measure. EARLIER and EARLIEST rely on row context, which exists in calculated columns but not in measures. The error message this produces can be confusing if you don't already know that distinction.
  • Assuming LOOKUP and LOOKUPVALUE are interchangeable. LOOKUPVALUE covers the overwhelming majority of real lookup needs and is the one worth learning first; LOOKUP exists for a narrower set of cases needing a full row rather than a single value.
  • Reaching for the Part Two functions before Part One feels solid. Window functions and visual calculations are powerful, but they're built on the assumption that filter context and CALCULATE already make sense. Trying to learn WINDOW before CALCULATE genuinely clicks tends to create more confusion than it solves.

Recommended Next Guides & Deep Dives

Continue expanding your Power BI and Fabric architecture knowledge with these closely connected tutorials:

Step-by-Step Implementation Sandbox

1. Establish your starting filter context

Observe your active page filters, slicers, and visual groupings to understand what initial context is applied to your calculation.

2. Incorporate CALCULATE to modify filters

Write your DAX measure using CALCULATE as the primary engine, embedding other filter modifying functions like FILTER, ALL, or ALLEXCEPT to shape row inclusion.

Frequently Asked Questions

What's the difference between ALL and ALLEXCEPT in DAX?

ALL removes every filter from the specified table or column. ALLEXCEPT removes every filter except for the specific column or columns you name, keeping just those intact while clearing everything else.

Why can't I use EARLIER inside a measure?

Because EARLIER depends on row context, which only exists in calculated columns and certain iterating functions. Measures operate using filter context instead, so there's no outer row for EARLIER to reach back to.

When should I use LOOKUPVALUE instead of a relationship?

Use LOOKUPVALUE when you need to pull in a value from another table but building a formal relationship between the two tables isn't practical or desired. If a relationship already exists, RELATED is usually the simpler choice.

Are window functions like WINDOW and OFFSET necessary to learn as a beginner?

No. They're a more recent, more advanced addition to DAX, primarily tied to the visual calculations feature. Most everyday report-building relies entirely on the core functions covered in Part One.

What's the simplest way to understand CALCULATE?

Think of it as taking an existing calculation and re-running it under a different set of conditions than whatever's currently active. Almost every other filter function in this guide exists to help define exactly what those modified conditions should be.

Vivek Dhumal

Vivek Dhumal

BI Consultant

BI Consultant & Power BI Developer

Vivek Dhumal is a dedicated BI Consultant and Data Analyst specializing in Power BI development, DAX calculations, SQL data modeling, ETL automation, and scalable business intelligence solutions.