๐ง Power BI DAX | Difference between FILTER, FILTERS, and KEEPFILTERS ๐งฉ
Understanding the difference between FILTER
, FILTERS
, and KEEPFILTERS
in DAX is crucial for mastering context manipulation in Power BI.
1๏ธโฃ FILTER
Function ๐
Used to create a table expression that returns filtered rows from a table.
Syntax:
โ Best for complex row-level conditions.
๐ Example:
2๏ธโฃ FILTERS
Function ๐งพ
Returns the current filter context applied on a column.
Syntax:
โ Used to check which filters are active.
๐ Example:
3๏ธโฃ KEEPFILTERS
Function ๐
Preserves the existing filters when used inside CALCULATE
, instead of overriding them.
Syntax:
โ Ensures additive filter logic instead of replacement.
๐ Example:
โ๏ธ Quick Comparison Table
Function | Purpose | Context Use |
---|---|---|
FILTER |
Returns filtered table | Row-level filtering |
FILTERS |
Returns filter context values | Context checks (e.g., slicers) |
KEEPFILTERS |
Keeps existing filters | Combine filters in CALCULATE |
Comments
Post a Comment