Replacing FILTER with KEEPFILTERS in Power BI
Short answer
D Replacing FILTER with KEEPFILTERS reduces execution time when referencing a single table column in Import mode.
Question
You have a Microsoft Power BI semantic model that contains measures. The measures use multiple CALCULATE functions and a FILTER function. You are evaluating the performance of the measures. In which use case will replacing the FILTER function with the KEEPFILTERS function reduce execution time?
Key Takeaways
DAX performance optimization favors Boolean expressions over FILTER for Import storage mode, making KEEPFILTERS the efficient choice for single-table filters.
Replacing the FILTER function with KEEPFILTERS in DAX measures improves performance when filtering a single column in an Import mode table. This page explains the optimization benefits of using Boolean expressions over table expressions for DAX evaluation.
Common mistake: Choosing C (multiple tables) because KEEPFILTERS is thought to handle cross-table filtering better, but Boolean expressions in KEEPFILTERS cannot reference columns from multiple tables.
Expert Analysis
Why the Answer Is Correct
ReplacingFILTER with KEEPFILTERS allows the filter argument to be passed as a Boolean expression rather than a table expression. For Import mode tables, which are in-memory column stores, the DAX engine is explicitly optimized to efficiently filter columns using Boolean expressions. When the filter references a single table, this substitution significantly reduces execution time compared to the row-by-row iteration required by FILTER.Why the Other Options Are Wrong
Option A is incorrect because nestedCALCULATE functions create context transitions that are unrelated to the core performance difference between FILTER and KEEPFILTERS. Option B is incorrect because while referencing a measure inside FILTER is inefficient, KEEPFILTERS does not inherently resolve measure evaluation overhead. Option C is incorrect because Boolean expressions used with KEEPFILTERS have restrictions and cannot reference columns from multiple tables; thus, FILTER remains necessary in those cross-table scenarios.Community Comment Notes
Commenters correctly identified that Import model tables are optimized for Boolean expressions, as IAMcertified noted by referencing the docs: "This article is especially relevant for model calculations that apply filters to Import tables". Another commenter, lpuech, pointed out that options A, B, and C represent limitations where Boolean expressions cannot be used effectively, further validating option D.Official Reference
Exam Strategy
When evaluating DAX performance, remember that FILTER generates a table expression and iterates row-by-row, whereas KEEPFILTERS leverages optimized Boolean expressions. Look for Import mode and single-table references as the primary indicators where KEEPFILTERS improves speed.
Community Votes
80% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 19 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded.
From public community threads 19
-
lpuech 👍 20 Answered DExplanation here: https://learn.microsoft.com/en-us/dax/best-practices/dax-avoid-avoid-filter-as-filter-argument FILTER returns a table whereas KEEPFILTERS returns a Boolean. So, A, B and C are limitations of uses of Boolean expressions.
-
pppppppppie 👍 4he KEEPFILTERS function in Power BI is primarily designed to work with single-table or single-column filter contexts. When you use the FILTER function to reference columns from multiple tables, KEEPFILTERS may not work directly because it operates within the context of a single table or column. A is the ans
-
trietnv 👍 4D. ref: https://learn.microsoft.com/en-us/dax/best-practices/dax-avoid-avoid-filter-as-filter-argument
-
neoverma 👍 4can someone clarify this answer
-
thisiston 👍 3 Answered AA is correct because Option A (when the FILTER function uses a nested calculate function): The FILTER function in DAX filters a table to the rows that meet the condition provided in its arguments. When FILTER is used within a CALCULATE function, it typically modifies the context in which the calculation is performed. If FILTER uses a nested CALCULATE function, it creates a context transition. Using KEEPFILTERS in this scenario can improve performance by modifying the behavior of context transition to ensure that existing filters on a table are not unintentionally removed or overridden, which can otherwise increase the complexity and computational load of the query.
Show 14 more comments
-
IAMcertified 👍 3The answer is D based on this page: https://learn.microsoft.com/en-us/dax/best-practices/dax-avoid-avoid-filter-as-filter-argument . Check out this Note in the given link "This article is especially relevant for model calculations that apply filters to Import tables.". Also, see this section extract in the given link : "restrictions that apply to Boolean expressions(KEEP Filters) when they're used as filter arguments. They: -Cannot reference columns from multiple tables -Cannot reference a measure -Cannot use nested CALCULATE functions -Cannot use functions that scan or return a table
-
neoverma 👍 3 Answered CIn general, every time you have to preserve the combination of columns coming from different tables, KEEPFILTERS is probably needed. Even though this could be required for columns of the same table, KEEPFILTERS is not required whenever there is a column that represents a cardinality higher than the intersection of the other columns – such as Date[Calendar Year Month] instead of the intersection of Date[Month] and Date[Calendar Year]. https://www.sqlbi.com/articles/when-to-use-keepfilters-over-iterators/
-
CPS_Certifications 👍 2Correct Answer is D Reference: "It's recommended you pass filter arguments as Boolean expressions, whenever possible. It's because Import model tables are in-memory column stores. They are explicitly optimized to efficiently filter columns in this way." https://learn.microsoft.com/en-us/dax/best-practices/dax-avoid-avoid-filter-as-filter-argument
-
282b85d 👍 2 Answered DThe use case in which replacing the FILTER function with the KEEPFILTERS function will most likely reduce execution time is when the FILTER function references a column from a single table that uses Import mode. This scenario allows KEEPFILTERS to optimize the filter application process more efficiently than FILTER.
-
trysec 👍 2 Answered DThis is because KEEPFILTERS can efficiently maintain the current filter context on the imported table without the need to create a new table through FILTER, thus reducing the computational overhead and improving performance.
-
emmanuelkech 👍 2 Answered BWhen you replace FILTER with KEEPFILTERS, you avoid re-evaluating the entire table for each row. Instead, it leverages the existing context, resulting in better performance.
-
dp600 👍 2view this --> https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/1-Diff-between-Filter-and-KeepFilters/m-p/2694220
-
hello2tomoki 👍 1Replacing the FILTER function with the KEEPFILTERS function will reduce execution time in the use case where the FILTER function references columns from multiple tables (Option C). This is because KEEPFILTERS is more efficient when it intersects with an existing filter context, which can occur when conditions involve multiple columns (https://www.sqlbi.com/articles/using-keepfilters-in-dax-updated/)
-
David_Webb 👍 1 Answered AKEEPFILTERS is a filter modifier that does not delete existing column or table filters in the filter context that conflict with the filters applied by the KEEPFILTERS parameter. https://community.fabric.microsoft.com/t5/Desktop/Conceptual-Question-FILTER-vs-KEEPFILTERS-vs-neither-What-is-the/td-p/1438803
-
Pegooli 👍 1 Answered BReplace FILTER with KEEPFILTERS in measures when you want to retain and respect existing filters in the current context, leading to potentially improved performance by reducing the overhead associated with creating new filter contexts.
-
Unbounded 👍 1This is a very confusing question. If a FILTER references the entire table rather than a single table, then using KEEPFILTER is a better choice, but none of the options actually specify that.
-
DarioReymago 👍 1 Answered AThe answer is A we use keep filters for nesting https://learn.microsoft.com/en-us/dax/keepfilters-function-dax
-
dp600 👍 1 Answered AI'm a bit confused, in any case I will go with A because context transition
-
6d1de25 👍 1 Answered DD is correct
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DP-600 Questions
Access 115 questions with complete answers and detailed explanations.
View Full DP-600 Practice Test →