Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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

7 REPLIES 7
Anonymous
Not applicable

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

Thats a great solution. Just to add more, make use of the "Filters on this visual" and add possibly the relationship column from the other table and make use of Advanced Filtering in Filter type and select "is not blank" or "is not empty".

I couldn't get this to work, i tried to add a field from the related table as a filter on the slicer visual, and i was not getting a filtered view. was i not doing it correctly?

possibly in that case, create a measure COUTROWS(tablename) and then add to the filter and set the filter as 'not blank'.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.