Replacing FILTER with KEEPFILTERS in Power BI

Answer Correct answer: D — replacing FILTER with KEEPFILTERS reduces execution time when referencing a single table column in Import mode.

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?

  1. when the FILTER function uses a nested calculate function
  2. when the FILTER function references a measure
  3. when the FILTER function references columns from multiple tables
  4. when the FILTER function references a column from a single table that uses Import mode Correct Answer

Community Votes

D
80%
A
20%

80% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

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.

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.

Community Discussion (19 comments)

lpuech 👍 20 Selected: D
Explanation 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.
CPS_Certifications 👍 2
Correct 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
Pegooli 👍 1 Selected: B
Replace 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.
6d1de25 👍 1 Selected: D
D is correct
DarioReymago 👍 1 Selected: A
The answer is A we use keep filters for nesting https://learn.microsoft.com/en-us/dax/keepfilters-function-dax
IAMcertified 👍 3
The 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
David_Webb 👍 1 Selected: A
KEEPFILTERS 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
282b85d 👍 2 Selected: D
The 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 Selected: D
This 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.
trietnv 👍 4
D. ref: https://learn.microsoft.com/en-us/dax/best-practices/dax-avoid-avoid-filter-as-filter-argument
dp600 👍 1 Selected: A
I'm a bit confused, in any case I will go with A because context transition
Unbounded 👍 1
This 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.
hello2tomoki 👍 1
Replacing 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/)
emmanuelkech 👍 2 Selected: B
When 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.
thisiston 👍 3 Selected: A
A 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.
pppppppppie 👍 4
he 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
dp600 👍 2
view this --> https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/1-Diff-between-Filter-and-KeepFilters/m-p/2694220
neoverma 👍 3 Selected: C
In 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/
neoverma 👍 4
can someone clarify this answer

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Replacing FILTER 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 nested CALCULATE 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.

Related Analysis

Practice All DP-600 Questions

Access 115 questions with complete answers and detailed explanations.

View Full DP-600 Practice Test →

← Back to DP-600 Study Guide