FILTERS DAX Function (Table manipulation)

Returns a table of the filter values applied directly to the specified column.

Syntax

FILTERS ( <ColumnName> )
Parameter Attributes Description
ColumnName

The column for which filter values are to be returned.

Return values

Table A table with a single column.

A column of unique values.

Remarks

When FILTERS is evaluated in an expression grouped in SUMMARIZECOLUMNS the original filter could be lost and replaced by the result of the auto-exists behavior that combines all the filters on the same table into a single filter. The combined table resulting from this filter only contains columns explicitly listed in SUMMARIZECOLUMNS as grouping columns or filter columns.

» 1 related article

Examples

--  FILTER returns the filters directly applied to a column
EVALUATE
CALCULATETABLE (
    FILTERS ( 'Product'[Category] ),
    'Product'[Category] = "Audio"
)

EVALUATE
CALCULATETABLE (
    FILTERS ( 'Product'[Category] ),
    'Product'[Category] IN { "Audio", "Computers" }
)
Category
Audio
Category
Audio
Computers
--  Non-existing values are not considered as filters
--  The "Bananas" category does not exist in Product table
EVALUATE
CALCULATETABLE (
    FILTERS ( 'Product'[Category] ),
    'Product'[Category] IN { "Audio", "Bananas" }
)
Category
Audio
--  Filter on one column does not affect other columns,
--  which are cross-filtered but not filtered.
--  Only "Cameras and camcorders" has products with Azure color.
EVALUATE
CALCULATETABLE (
    FILTERS ( 'Product'[Category] ),
    'Product'[Color] = "Azure"
)

EVALUATE
CALCULATETABLE (
    VALUES ( 'Product'[Category] ),
    'Product'[Color] = "Azure"
)

--  Table filter include columns used in FILTERS
EVALUATE
CALCULATETABLE (
    FILTERS ( 'Product'[Category] ),
    FILTER ( 'Product', 'Product'[Color] = "Azure" )
)
Category
Audio
TV and Video
Computers
Cameras and camcorders
Cell phones
Music, Movies and Audio Books
Games and Toys
Home Appliances
Category
Cameras and camcorders
Category
Cameras and camcorders
--  FILTERS returns its values even though there are no
--  rows satisfying the set of conditions.
--  The table returned by FILTERS has the correct lineage.
EVALUATE
CALCULATETABLE (
    ADDCOLUMNS (
        FILTERS ( 'Product'[Color] ),
        "#Prods", CALCULATE ( COUNTROWS ( 'Product' ) )
    ),
    'Product'[Color] IN { "White", "Azure" },
    'Product'[Brand] = "Litware"
)
Color #Prods
White 45
Azure (Blank)

Related articles

Learn more about FILTERS in the following articles:

Last update: Nov 7, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/filters-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of FILTERS? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.