Skip to main content

Power BI

New

New DAX Function: FILTERCONTEXT ()

Vote (10) Share
Alexander Dupler's profile image

Alexander Dupler on 13 Mar 2020 13:41:30

There are a number of applications where you want a DAX expression to return every filter currently effecting a visual. There should be a function that does this. Today you can get this effect by creating an expression like: IF(ISFILTERED () ,SELECTEDVALUE () ) for every column you care about. or something even more complicated to trap multiple values. And it doesn't trap equalities or other things.
Instead, there should be a single function that just returns the current context as a string.

On the report canvas, the new popup filter context card does a great job of highlighting this to users, but it doesn't cover all use cases.

Some example applications:

Complicated DAX aggregations may need to know the exact filter conditions not just the resulting values in filtering column. Things like Accordian or Horizontal aggs could be even more efficient if you know whether someon picked 43 particular days, or just picked a date range with an equality.

Using Gil Raviv's Power BI Pixel technique to track usage, you might want a verbose statement of context.

Creating label measures that show the current filter context explicitly: While the new filter cards are great they don't work in zero applications dashboards. Also sometimes, you want the context to be plainly visible to all users.