powerbisliceslicers

Power BI Desktop - Create a slicer with Unique values applied to multiple columns


I have a table with hundreds of tasks. Those tasks can be have multiple assignees, so I have multiple columns for capturing them: Assignee.1, Assignee.2, and so on. I want to create a single slice where it filters tasks based on the name of the assignee, regardless if this comes up in the Column 1, 2, 3... - any column which assignees are captured.

Sample of the data structure:

enter image description here


Solution

  • This data format is not suitable for what you want to do. You need to have a table with two columns - Task Title and Assignee. If you can't get your data in a proper format, you can transform this one. Duplicate your table (let's rename the copy to Task Users for example), select the assignee columns and unpivot them (click Transform -> Unpivot Columns). Delete the Attribute column (you don't need it) and rename Value to User Name. Remove the rows with blank values in User Name column by clicking the button in the header and unselecting the (blank) value.

    At the end you should end with something like this:

    enter image description here

    Now you should have a relationship between Tasks -> Title and Task Users -> Title (add it manually if Power BI doesn't detect this automatically). Make sure that the cross filter direction of this relationship is set to Both:

    enter image description here

    Now you can add Task Users -> User Name column to a slicer in your report and it will filter the Tasks table properly:

    enter image description here