Capture the Selected Filter in PowerBI – DAX

ByHariharan Rajendran

Capture the Selected Filter in PowerBI – DAX

As PowerBI has various options to slice and dice the data, it is very mandatory to understand the filter context on the PowerBI report.

Filter Context can be applied on various levels

  1. Row & Column Headers
  2. Slicers
  3. Filters (Visual, Page & Report level)

Let us take a scenario where the user wants to capture the filters applied to the specific field.

To demonstrate this scenario, I create a simple table as like below.

I need to use Description field on the table to filter the data.

Description field on Slicer

If the user selects the checkbox then it should show the selected value. If it is a single selection, then show the value. If users select multiple values, then show as “Mulitple”.

Description field on Filter (Page level Filter)

Place the description field on the page level filter and see the outcome.

Use the below DAX script to achieve the result.

Parameter Selection =
IF (
HASONEVALUE ( Parameters[Value] ),
“Selection” & VALUES ( Parameters[Description] ),
IF (
NOT ( ISFILTERED ( Parameters[Description] ) ),
“No Selection”,
“Mulitple Selection”
)
)

About the Author

Hariharan Rajendran author

Hariharan Rajendran is a Microsoft Certified Trainer and Lead BI Solutions Consultant with 8+ years of experience in Database, BI and Azure platforms. Hariharan is also an active community leader, speaker & organizer and leads the Microsoft PUG (Power BI User Group – Chennai), SQLPASS Power BI Local Group – Chennai and an active speaker in SQL Server Chennai User Group and also a leader in Data Awareness Program worldwide events. Hariharan also frequently blogs (www.dataap.org/blog), provides virtual training (on ad-hoc basis) on Microsoft Azure, Database Administration, Power BI and database development to worldwide clients/audience.

Comments Are Closed!!!