Forum Discussion
Use slicer to a filter table based on values in multiple columns
I am very new to Power BI and DAX in general so please forgive me:
So the context of the story is:
- I have conducted a survey where there were questions with free text
- I've then created a table of "themes" where it's simply a single list of themes that each comment would be categorised by
- I have then created 3 separate category columns for each question's response where up to 3 Themes can be allocated to each response, (all the values are based on the values in the Themes table mentioned above)
- I have then created a Table visualisation where the Response, Category 1, Category 2, Category 3 are all represented (all of these are from the same table)
- I have then created a Slicer visualisation with the column out of the List of Themes table is put in it that has the unique list of themes to filter on.
- But now, when I select a Theme on the Slicer, it only seems to filter based on Category 1 and completely ignore the rest of the rows where the selected Theme was in Category 2 or 3.
TABLE COMMENTS
Response Comment Category 1 Category 2 Category 3
This is a random response 1 x y z
This is a random response 2 x y null
This is a random response 3 x z null
This is a random response 4 z x y
TABLE THEMES
Category
x
y
z
The result i'm expecting is, when I select Theme X from Slicer, I need to see all rows from the top table. Right now I can only see the responses 1,2 and 3.
Don't forget that this is the scenario for just 1 question and i need to replicate it for 3 questions in total (i don't want them to be together).
I can't use the unpivot function as there are relationships between the "Response Comment" and other tables that won't allow it to have duplicate values in that column after you unpivot.
Any help would be appreciated.
Anonymous,
Make the relationship inactive between these two tables and add measure below. It takes advantage of Show Categories With No Data.
Measure = VAR t = VALUES ( THEMES[Category] ) RETURN IF ( COUNTROWS ( FILTER ( COMMENTS, COMMENTS[Category 1] IN t || COMMENTS[Category 2] IN t || COMMENTS[Category 3] IN t ) ) > 0, 1 )
1 Reply
- v-chuncz-msft
Community Support
Anonymous,
Make the relationship inactive between these two tables and add measure below. It takes advantage of Show Categories With No Data.
Measure = VAR t = VALUES ( THEMES[Category] ) RETURN IF ( COUNTROWS ( FILTER ( COMMENTS, COMMENTS[Category 1] IN t || COMMENTS[Category 2] IN t || COMMENTS[Category 3] IN t ) ) > 0, 1 )