Home > Net >  How can I filter multiple columns that include the same value in Power BI?
How can I filter multiple columns that include the same value in Power BI?

Time:01-15

I currently have a table in Power BI named Jira Tickets.

Here is sample data from Jira Tickets:

Issue id Label Label 1 Label 2 Label 3 Label 4
1000 Apples Grapes Bananas Oranges Strawberries
1001 Oranges Pears Apples Bananas Strawberries
1002 Pears Dragon Fruit Apples Strawberries Dragon Fruit
1003 Bananas Oranges Apples Grapes Pears
1004 Grapes Apples Bananas Pears Strawberries

I want to create a slicer in Power Bi to filter by the column values in Label Label 1 Label 2 Label 3 Label 4. The issue is that this gets confusing when choosing which column value to filter by, as the same column value exists within different columns. For example, If I wanted to filter by Apples, I would need to select multiple Apples values from Label Label 1 Label 2 and Label 4.

How can I create a slicer in Power BI to ensure I can filter uniquely by: Apples Oranges Pears Bananas Strawberries Dragon Fruit Grapes?

CodePudding user response:

Create disconnected table for alllabel:

enter image description here

AllLabel = SUMMARIZE(UNION(VALUES(Fruit[Label 1]), VALUES(Fruit[Label 2]), VALUES(Fruit[Label 3]), VALUES(Fruit[Label 4])),Fruit[Label 1])

Create a measure:

PickThis = 
var _selectedFruit = SELECTEDVALUE(AllLabel[Label 1])
return
CALCULATE(COUNTROWS(Fruit) , FILTER(Fruit,Fruit[Label 1] = _selectedFruit || Fruit[Label 2] = _selectedFruit || Fruit[Label 3] = _selectedFruit || Fruit[Label 4] = _selectedFruit))

Add measure to your visualization (or to filter):

enter image description here

enter image description here

  •  Tags:  
  • Related