Short answer: DAX's filter functions change or read the filter context. CALCULATE and CALCULATETABLE evaluate an expression under changed filters. FILTER returns the rows that meet a condition. The ALL family (ALL, ALLEXCEPT, ALLSELECTED, ALLNOBLANKROW, ALLCROSSFILTERED, REMOVEFILTERS) removes filters, and KEEPFILTERS adds instead of replacing. SELECTEDVALUE reads a single selection, LOOKUPVALUE finds a value by keys, and EARLIER reaches an outer row. Microsoft's filter group also holds the window functions (OFFSET, INDEX, WINDOW, RANK, ROWNUMBER) and the visual calculation functions.
This page lists them all, with one example each, and links to the posts that explain the important ones in depth.
Which functions change the filter context?
| Function | Does | Example |
|---|---|---|
| CALCULATE | evaluates a scalar expression with changed filters | CALCULATE ( [Revenue], 'Product'[Color] = "Red" ) |
| CALCULATETABLE | evaluates a table expression with changed filters | CALCULATETABLE ( VALUES ( Customer[Customer] ), 'Date'[Year] = 2026 ) |
| FILTER | returns the rows of a table that meet a condition | FILTER ( VALUES ( Customer[Customer] ), [Revenue] > 10000 ) |
| KEEPFILTERS | makes a filter intersect with existing filters | CALCULATE ( [Revenue], KEEPFILTERS ( 'Product'[Color] = "Red" ) ) |
In depth: CALCULATE, FILTER, KEEPFILTERS.
Which functions remove filters?
| Function | Returns a table? | Does | Example |
|---|---|---|---|
| ALL | yes | all rows or distinct values, ignoring filters; removes filters in CALCULATE | COUNTROWS ( ALL ( 'Product' ) ) |
| ALLEXCEPT | yes | removes all filters on a table except the listed columns | CALCULATE ( [Revenue], ALLEXCEPT ( 'Product', 'Product'[Category] ) ) |
| ALLSELECTED | yes | removes the visual's row and column filters, keeps slicers | CALCULATE ( [Revenue], ALLSELECTED ( 'Product' ) ) |
| ALLNOBLANKROW | yes | like ALL, without the blank row of unmatched keys | COUNTROWS ( ALLNOBLANKROW ( 'Product' ) ) |
| ALLCROSSFILTERED | no | clears all filters applied to a table, also those from other tables | CALCULATE ( [Revenue], ALLCROSSFILTERED ( Sales ) ) |
| REMOVEFILTERS | no | removes filters from tables or columns; preferred for just removing | CALCULATE ( [Revenue], REMOVEFILTERS ( 'Product' ) ) |
In depth: ALL, ALLEXCEPT and REMOVEFILTERS, ALLSELECTED.
Which functions read values?
| Function | Does | Example |
|---|---|---|
| SELECTEDVALUE | the value when exactly one is filtered, else an alternate | SELECTEDVALUE ( 'Date'[Year], "All years" ) |
| LOOKUPVALUE | the value in the row matching all search values | LOOKUPVALUE ( Rates[Rate], Rates[Currency], "USD", Rates[Date], DATE ( 2026, 10, 1 ) ) |
| EARLIER | a column's value in the outer row context | FILTER ( Sales, Sales[Date] <= EARLIER ( Sales[Date] ) ) |
| EARLIEST | the value in the outermost row context | EARLIEST ( Sales[Date] ) |
In depth: SELECTEDVALUE and HASONEVALUE, LOOKUPVALUE, EARLIER and EARLIEST.
Which window functions are filter functions?
They return rows relative to the current one, in a table ordered and partitioned as you say:
| Function | Returns | Example |
|---|---|---|
| OFFSET | the row a given distance away | CALCULATE ( [Revenue], OFFSET ( -1, ALLSELECTED ( 'Date'[Year Month] ), ORDERBY ( 'Date'[Year Month] ) ) ) |
| INDEX | the row at an absolute position | CALCULATE ( [Revenue], INDEX ( 1, ALLSELECTED ( 'Date'[Year Month] ), ORDERBY ( 'Date'[Year Month] ) ) ) |
| WINDOW | a range of rows, absolute or relative | CALCULATE ( [Revenue], WINDOW ( -2, REL, 0, REL, ALLSELECTED ( 'Date'[Year Month] ), ORDERBY ( 'Date'[Year Month] ) ) ) |
| RANK | the rank of the current row by columns, with ties (DENSE or SKIP) | RANK ( DENSE, ALLSELECTED ( 'Product'[List Price] ), ORDERBY ( 'Product'[List Price], DESC ) ) |
| ROWNUMBER | a unique number for the current row | ROWNUMBER ( ALLSELECTED ( Customer[Customer] ), ORDERBY ( Customer[Customer] ) ) |
| ORDERBY | the sort of the window's rows | ORDERBY ( 'Date'[Year Month], ASC ) |
| PARTITIONBY | the groups the window restarts in | PARTITIONBY ( 'Date'[Year] ) |
| MATCHBY | the columns that identify the current row | MATCHBY ( 'Date'[Year Month] ) |
Microsoft notes that RANK does not relate to RANKX as SUM to SUMX: RANK orders by columns of the relation, while RANKX ranks by any expression, such as a measure. In depth: OFFSET, WINDOW, INDEX, RANK and ROWNUMBER.
Which are visual calculation functions?
RUNNINGSUM, MOVINGAVERAGE, PREVIOUS, NEXT, FIRST, LAST, RANGE, LOOKUP and LOOKUPWITHTOTALS work in visual calculations, on the visual's own rows and columns:
Running sum = RUNNINGSUM ( [Sales Amount] )
Versus previous = [Sales Amount] - PREVIOUS ( [Sales Amount] )
Bikes value = LOOKUP ( SUM ( [Sales Amount] ), [Category], "Bikes" )All of them: visual calculation functions.
What goes wrong?
- REMOVEFILTERS where a table is needed. It only removes filters; to iterate or count all rows, use
ALL. - ALLCROSSFILTERED as a table. Like
REMOVEFILTERS, it cannot return a table. - Window functions without a stable order. Ties in
ORDERBYmakeOFFSETandINDEXambiguous; order by a unique column or add one. - DirectQuery limits. Several of these functions are not supported in calculated columns or RLS rules in DirectQuery mode; check each function's page.
Where can you check this?
- Microsoft Learn: Filter functions (DAX)
- Microsoft Learn: ALLCROSSFILTERED function (DAX)
- Microsoft Learn: CALCULATETABLE function (DAX)
Where do you start?
Learn CALCULATE, FILTER, REMOVEFILTERS and SELECTEDVALUE first: they cover most measures. Then OFFSET for comparisons with the previous row.