Table of contents
Collapse the table of content
Expand the table of content

FILTER Function (DAX)

Owen Duncan|Last Updated: 5/22/2018

Returns a table that represents a subset of another table or expression.




tableThe table to be filtered. The table can also be an expression that results in a table.
filterA Boolean expression that is to be evaluated for each row of the table. For example, [Amount] > 0 or [Region] = "France"

Return Value

A table containing only the filtered rows.


You can use FILTER to reduce the number of rows in the table that you are working with, and use only specific data in calculations. FILTER is not used independently, but as a function that is embedded in other functions that require a table as an argument.


The following example creates a report of Internet sales outside the United States by using a measure that filters out sales in the United States, and then slicing by calendar year and product categories. To create this measure, you filter the table, Internet Sales USD, by using Sales Territory, and then use the filtered table in a SUMX function.

In this example, the expression FILTER('InternetSales_USD', RELATED('SalesTerritory'[SalesTerritoryCountry])<>"United States") returns a table that is a subset of Internet Sales minus all rows that belong to the United States sales territory. The RELATED function is what links the Territory key in the Internet Sales table to SalesTerritoryCountry in the SalesTerritory table.

The following table demonstrates the proof of concept for the measure, NON USA Internet Sales, the formula for which is provided in the code section below. The table compares all Internet sales with non- USA Internet sales, to show that the filter expression works, by excluding United States sales from the computation.

To re-create this table, add the field, SalesTerritoryCountry, to the Row Labels area of the PivotTable.

Table 1. Comparing total sales for U.S. vs. all other regions

Row LabelsInternet SalesNon USA Internet Sales
United Kingdom$5,057,076.55$5,057,076.55
United States$9,389,479.79
Grand Total$26,054,827.45$16,665,347.67

The final report table shows the results when you create a PivotTable by using the measure, NON USA Internet Sales. Add the field, CalendarYear, to the Row Labels area of the PivotTable and add the field, ProductCategoryName, to the Column Labels area.

Table 2. Comparing non- U.S. sales by product categories

Non USA Internet SalesColumn Labels
Row LabelsAccessoriesBikesClothingGrand Total
Grand Total$384,639.63$16,107,890.23$172,817.81$16,665,347.67
SUMX(FILTER('InternetSales_USD', RELATED('SalesTerritory'[SalesTerritoryCountry])<>"United States")  

See Also

Filter Functions (DAX)
ALL Function (DAX)

© 2018 Microsoft