cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
dparkinson
Advocate I
Advocate I

Filtering a table based on values from an unrelated table

I have a table with a column that has multiple values in it.  I'd like to create a slicer from another (lookup) table which filters the results from the first table based on the items selected.

 

This is easier to explain with an example:

 

My "Things" Table:

things1.png

My TechCompanies lookup table:

 

things2.png

 

I'd like to create a slicer from the lookup table which allows me to filter the first table based on items selected in the slicer.  It must allow multiple items to be selected in the slicer:

 

things3.png

 

I hope that makes sense.  Any feedback greatly appreciated.

 

Many thanks,

D.

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft
Microsoft

Hi @dparkinson,

 

Based on my test, you should be able to use the formula below to create a new measure first, then use it as visual level filter(Measure is greater than 0) to get the expected result in your scenario. Smiley Happy

Measure = 
COUNTROWS (
    FILTER (
        TechCompanies,
        SEARCH ( TechCompanies[techcode], MAX ( Things[Thing Companies] ),, 0 ) > 0
    )
)

r1.PNG

 

Here is the sample pbix file for your reference. Smiley Happy

 

Regards

View solution in original post

4 REPLIES 4
v-ljerr-msft
Microsoft
Microsoft

Hi @dparkinson,

 

Based on my test, you should be able to use the formula below to create a new measure first, then use it as visual level filter(Measure is greater than 0) to get the expected result in your scenario. Smiley Happy

Measure = 
COUNTROWS (
    FILTER (
        TechCompanies,
        SEARCH ( TechCompanies[techcode], MAX ( Things[Thing Companies] ),, 0 ) > 0
    )
)

r1.PNG

 

Here is the sample pbix file for your reference. Smiley Happy

 

Regards

Thank you so much. I was facing a similar problem of filtering with a non related table. Now, after creating a measure, it is working. Thanks a lot again.

This worked for me until I tried to aggregate. I am trying to make an easy way to filter some parts of reports with a different date. For example part of the report using an entire year another part I want to be a variable date range. I used the measure technique to match against another date table that can be filtered at the report level. When I just display the range of dates it works. If I set the report filter on the second unrelated date table to may I can get a list of 31 dates. But if I change that same visual to a card with a distinct count I get 310 instead of 31?? Any ideas?

That's great.  Thanks for the reply.  Seems to work great -- I'll give it a go on my proper dataset.

 

I think I ideally need to extract that field out to another table somehow and give it a many-to-many relationship so that I can crossfilter more easily etc.  I'll maybe add another question for that.

 

Thanks once again.

D.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors