Forum Discussion
bidirectional filtering not working
I have a fact table and dim_games table connected through game_id in bidirectional relationship. I have game_name as a filter for all pages coming from the dim_games table. I want to see only those games in the filter which have sales(data) in the fact table. Eventhough the connection is bidirectional I still see all games. Why the bidirecitonal filter is not propagated from the fact to the dim table? I want to achive this with filters and not slicers.
Thanks
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.
4 Replies
- Dezmond95Frequent Visitor
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.
- ivanmezevFrequent Visitor
Thanks, this is exactly what I need. Not sure how fast it will be with millions of rows in the fact table but I'll test it.
- AnonymousNot applicable
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 TeamIf 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
- ivanmezevFrequent Visitor
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