cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nuuki
Regular Visitor

Only show relevant values in a slicer?

Hi,

 

I'm a newcomer to Power BI Desktop, having recently dipped my toe having previously done some basic work with Power Query. Most of that previous activity involved using Power Query primarily to load and trandform data, and the migration to using the data model and relationships is giving me some new options and challenges, as previously I was sticking with merging tables and using them in Excel. Here's a good example of a struggle I'm having...

 

 

So lets say I have a table consisting of restaurant dishes - this contains an ID, and then a bunch of information such as country of origin, calories, ingredients etc.

 

I then have a second table showing sales from a restaurant - that might include a unique order reference, as well as the recipe code, allowing it to be linked to the previous table - all easy so far.

 

So now I create a matix visualisation to present the sales data. I add some slicers to the sheet to let me filter the data as I want, and one of the slicers is for country or origin.

 

If I had merged the tables together and built my matrix from the resulting table, the slicer would only show me the relevant countries i.e. those that were actually represented in the orders list. However by building off the source tables through a relationship, I'm seeing every country listed that's in that recipes table. I can see why it would do that by default, but is there a way to only show the values in the that match a value in both tables?

 

This is obviously a made up example, but its coming up in a few areas so hopefully makes sense. Thanks in advance for any advice.

1 ACCEPTED SOLUTION
Nuuki
Regular Visitor

Having done some further research, I found this solution:

 

https://www.fourmoo.com/2017/01/24/power-bi-how-to-filter-slicers-dynamically/

 

Its well explained so hopefully useful to others as seems like a fairly common requirement. 

View solution in original post

4 REPLIES 4
rajendran
Community Champion
Community Champion

Hi @Nuuki

 

This is possible.Similar question has been answered here. I hope this will help you.

 

https://community.powerbi.com/t5/Desktop/Filter-Months-from-Month-Slicer/m-p/432765#M199475

 

Thanks

Raj

Hi,

 

Thanks for the reply. I've taken a look at the solution you linked to and I'm not sure quite how it applies. 

 

I'm trying to filter the slicer, which is based on a column in table A, to only show values that are relevant to the data in a table B, which is linked. The solution seems to show how to filter a slicer based on some pre-defined values, but I don't see how it takes into account the data in the table.

 

What am I missing?

Nuuki
Regular Visitor

Having done some further research, I found this solution:

 

https://www.fourmoo.com/2017/01/24/power-bi-how-to-filter-slicers-dynamically/

 

Its well explained so hopefully useful to others as seems like a fairly common requirement. 

Anonymous
Not applicable

Not sure if anyone will read this or not, but in the meantime it has become very easy to fix this using a filter on the slicer, adding the relevant value and saying "is not blank".

 

Thanks

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.