cancel
Showing results for
Did you mean:
Helper II

## Keepfilters vs Filters

Here I have calculted two measures and they produced the same result. which one is more efficient and why?

1 ACCEPTED SOLUTION
Super User

@Alex_Hasan

I would suggest you use the 1st Measure "Green Sales":

Explanation: You have effectively used KEEPFILTER here to show sales only when Green colour is visible. The most important point is, only the Product [Colour] column is used but the in the second measure, you are referring to the full Product table within the Filter function which is not efficient, also it will have the unexpected effect of expanded table.

Did I answer your question? Mark my post as a solution! and hit thumbs up
4 REPLIES 4
Super User

@Alex_Hasan

I would suggest you use the 1st Measure "Green Sales":

Explanation: You have effectively used KEEPFILTER here to show sales only when Green colour is visible. The most important point is, only the Product [Colour] column is used but the in the second measure, you are referring to the full Product table within the Filter function which is not efficient, also it will have the unexpected effect of expanded table.

Did I answer your question? Mark my post as a solution! and hit thumbs up
Super User

yes becuase the first one is actually

KEEPFILTERS ( FILTER(*Product, 'Product' [Color] = "green' ) )

where here KEEPFILTERS does nothing

Helper II

Super User

Sorry for the in accurate explanation.
CALCULATE ( [Amount], "Product' [Color] = "green" ) is actually translated into

CALCULATE ( [Amount], FILTER ( ALL ( Product), 'Product' [Color] = "green" ))

Which returns the value of green in all cells.
this is because the filter context of each cell contains the coplete product table while when using only FILTER the filter context  in each cell contains only the related color therefore the intersection is empty except for green.

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors