Reputation: 11
So I have a column like this in Power BI matrix
Country
India
India, Pakistan
Myanmar, Bhutan, India
I want to add a filter, where if I choose India, all the above three entries should return.
Currently my filter looks like this:
India
India, Pakistan
Myanmar, Bhutan, India
I want it to look like this
India
Pakistan
Myanmar
Bhutan
Upvotes: 1
Views: 848
Reputation: 11
Here are the steps which i followed to solve the issue
Upvotes: 0
Reputation: 1024
You can create a "NEW TABLE" from the modelling menu and use the following DAX query;
FilterTable =
VAR tmp =
ADDCOLUMNS ( Sheet1, "ItemPaths", SUBSTITUTE ( CONCATENATEX(Sheet1, Sheet1[Column1]), ",", "|" ) )
RETURN
DISTINCT(SELECTCOLUMNS (
GENERATE (
tmp,
ADDCOLUMNS (
GENERATESERIES ( 1, PATHLENGTH ( [ItemPaths] ) ),
"Items", TRIM(PATHITEM ( [ItemPaths],[Value], TEXT ))
)
),
"Countries", [Items]
))
Replace Sheet1 and Column1 with your table and column name...
Upvotes: 1