Allexcept Vs Keep Filters
Allexcept Vs Keep Filters
Purpose: Removes all filters from a table except the ones specified.
Usage: Used to control which columns should retain their filters while clearing
others.
Example:
This would remove all filters from the Sales table except for the Region column.
KEEPFILTERS
Purpose: Ensures that existing filters are maintained, even if new filters are
added.
Usage: Used within a CALCULATE function to keep the existing filters and add new
ones.
Syntax: KEEPFILTERS(expression)
Example:
This would sum the Amount in the Sales table where ProductCategory is "Bikes",
keeping any existing filters intact.
Key Differences
ALLEXCEPT removes all filters from the specified table except the ones you specify,
effectively resetting the context for the table but keeping certain filters.
KEEPFILTERS maintains the existing filters and adds additional filters on top,
ensuring the existing context is not lost.
ALLEXCEPT: Useful when you need to compare values across a table while keeping one
or more specific filters.
KEEPFILTERS: Useful when you want to add additional filter criteria without
overriding the existing filters in the context.