Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Keep filter Vs Calculate filter function

Hi

 

What is difference between below 2 formulas. With below formulas I got same results.

Then What is the use of KEEP FILTER & Where it is useful.

 

1)  CALCULATE(SUM(Data[Sales Amount]),FILTER(Data,Data[Product Category]="Formal"))

2)   CALCULATE(SUM(Data[Sales Amount]),KEEPFILTERS(Data[Product Category]="Formal"))

 

Regards

Raj Kumar

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

The FILTER function is used to return a subset table that contains the filtered rows.

Syntax:

FILTER(<table>,<filter>)

table → Mention table name which needs to be filtered.

filter → Expression which will be evaluated for each row of the table.

Some key points to remember about this function are following

1.FILTER cannot work independently, it should be embedded in other DAX functions that require a table as an argument.
2.This function is not supported by the DirectQuery connection mode.
KEEPFILTERS Function
Similarly, the KEEPFILTERS function is also used to return a subset table that contains the filtered rows.

Syntax:

KEEPFILTERS(expression)

expression → The expression will be evaluated for each row of the table.

Some key points to remember about this function are following

1.KEEPFILTERS function is used within another DAX function like CALCULATE, and then it will override the standard behaviour of the main function.
2.This function is not supported by the DirectQuery connection mode.

 

To learn more details about the different between the two dax ,refer the below article:

How to Work with FILTER, KEEPFILTERS, REMOVEFILTERS Functions in DAX — DAX in Power BI

 

 

Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Anonymous ,

The FILTER function is used to return a subset table that contains the filtered rows.

Syntax:

FILTER(<table>,<filter>)

table → Mention table name which needs to be filtered.

filter → Expression which will be evaluated for each row of the table.

Some key points to remember about this function are following

1.FILTER cannot work independently, it should be embedded in other DAX functions that require a table as an argument.
2.This function is not supported by the DirectQuery connection mode.
KEEPFILTERS Function
Similarly, the KEEPFILTERS function is also used to return a subset table that contains the filtered rows.

Syntax:

KEEPFILTERS(expression)

expression → The expression will be evaluated for each row of the table.

Some key points to remember about this function are following

1.KEEPFILTERS function is used within another DAX function like CALCULATE, and then it will override the standard behaviour of the main function.
2.This function is not supported by the DirectQuery connection mode.

 

To learn more details about the different between the two dax ,refer the below article:

How to Work with FILTER, KEEPFILTERS, REMOVEFILTERS Functions in DAX — DAX in Power BI

 

 

Best Regards

Lucien

lukiz84
Memorable Member
Memorable Member

FILTER filters a table

 

KEEPFILTERS keeps the existing filters on a column

 

KEEPFILTERS – DAX Guide

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.