Filter context in DAX refers to the set of filters that are currently applied to evaluate a calculation — basically, it defines which rows of data DAX should consider when performing a computation.
Whenever we place a field in a Power BI visual, like Region or Year, Power BI automatically creates a filter context. For example, if I have a measure Total Sales = SUM(Sales[Amount]), and I display it in a table by Region, DAX automatically applies a filter so that only the rows for each Region are considered when calculating the total. That’s the filter context in action — it narrows down the data dynamically depending on what the user is viewing.
In one of my dashboards, I had a requirement to calculate Year-to-Date (YTD) Sales. I used the DAX function:YTD Sales = TOTALYTD(SUM(Sales[Amount]), Calendar[Date])
Here, DAX calculates the total only for dates up to the current date in the selected year — the filter context is what makes sure it looks only at the relevant time period.
One challenge I faced early on was when filters from visuals interacted in unexpected ways. For instance, when users selected multiple slicers like Region and Product Category, my measure started giving wrong results because the filter context was overlapping. I fixed this by using functions like ALL() or REMOVEFILTERS() to modify or clear the filter context where needed. For example,Total All Sales = CALCULATE(SUM(Sales[Amount]), ALL(Sales))
ignores all filters on the Sales table and returns the overall total.
A limitation of filter context is that it doesn’t evaluate per-row logic by itself — for that, we need row context or iterator functions.
In short, row context tells DAX which row it’s working on, while filter context tells DAX which subset of data to consider. Together, they define how every DAX expression is evaluated in Power BI.
