Forum Discussion
bidirectional filtering not working
- 2 years ago
I'm assuming you have a situation where you have 3 games with sales (A, C, and E) and 2 with no sales (B and D) but if you add the Dim_Games table Game Name to the filter panel, you are seeing all games like in the first when you only want it to show A,C, and E like in the second image.
If this is the goal where you can only see those with sales in the filter panel (plus blank for some reason), I used a helper table.
The helper table is made using this dax code. It basically filters the Dim_Games table and only displays the Game_Name with sales greater than 0 (sales = sum(fact_table[sales]) and the Game ID.
This is so we can create a 1:* (1 to many) relationship from this new table to the fact table using the Game ID column. I also tested that it would add new game names if B suddenly had sales, it also showed up in the helper table during refresh.
Im hoping this helps.
Hi, ivanmezev
Based on your description, you want to implement filtering of sold games. I have created some measures to achieve the effect you are looking for. You can add this measure to the filter pan. Following picture shows the effect of the display.
Before:
After:
Measure:
Measure =
VAR _dim_game_id = SELECTEDVALUE(dim_games[game_id])
VAR _result =
IF (
COUNTROWS ( FILTER ( 'fact', 'fact'[game_id] = _dim_game_id ) ) > 0,
1,
BLANK ()
)
RETURN
_result
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi, Thanks for your reply but this is not exactly what I need.
If I use your example I don't want to see B and D in the game's filter because they don't have sales