π§ 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