๐ง 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