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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Filtering one table with 3 different columns from other

Hello, 

I'm a beginner in Power BI (low knowledge in DAX functions yet), and I would like to ask for some help in the challenge I'm facing:

 

I have two different tables: "Recommendations" and "Knowledge Database".

In the table "Recommendations", I have the 4 columns that I'm using as the slicers to filter my report accordingly to the image below (columns System, Size, Format, Opening). The first matrix visual (in red) belongs to the same table than the slicers, so until here I haven't had any problem. 

In the second table (Knowledge Database), I have the same 4 columns with one additional column called "Information".

My challenge here is that I want to show in the table in green the results of this "Information" column filtered by the slicers which belong to the "Recommendations" table. The problem is that the Power BI allows me only to create a relationship between one column of each table, so I have to choose only one slicer to use as filter, but I need to be able to filter the results using a mix of all the 4 slicers. (E.g. Filtering the System "TBA", Size "200", Format "All", Opening "All"; or filtering System "All", Size "400", Format "Base", Opening "All")

carlos_vale_1-1626979308025.png

Below you can see the images of both tables (First Image: Recommendations, Second Image: Knowledge Database)

carlos_vale_2-1626980040589.png           carlos_vale_3-1626980063478.png

 

Is there any way to perform such filter?

 

Thanks in advance!!

4 REPLIES 4
Mohammad_Refaei
Solution Specialist
Solution Specialist

You can create a measure to evaluate the filters

 

Filter =
IF ( SELECTEDVALUE ( 'Knowledge Database'[SYSTEM] ) in VALUES ( Recommendations[SYSTEM] ) &&
SELECTEDVALUE ( 'Knowledge Database'[SIZE] ) in VALUES ( Recommendations[SIZE] ) &&
SELECTEDVALUE ( 'Knowledge Database'[FORMAT] ) in VALUES ( Recommendations[FORMAT] ) &&
SELECTEDVALUE ( 'Knowledge Database'[OPENING] ) in VALUES ( Recommendations[OPENING] ),
"Keep", "Remove")

 

Then apply this measure to the visual filter and set it to Keep

m_refaei_0-1627018921355.png

 

Anonymous
Not applicable

Thanks a lot for your support!

However what if I need to select multiple values in my slicer? I mean, if in the "System" slicer I need to select "TBA" and "TCA". The SelectedValue expression does not allow me to get more than 1 value, and the "in" expression (I'm not sure) also only check for one argument, right?

The syntax should allow you to select multimple values since it is evaluating against all the available values in your target table (in VALUES ( Recommendations[SYSTEM] )

 

The selectedvalue is used at the row level in your 'Knowledge Database' table to filter each row against your selection.

 

Give it a try, it should work.

Anonymous
Not applicable

Hello @Mohammad_Refaei ,

I tried to apply the filter but, unfortunately, it is not working. I did exactly as you suggested (only changed the "," to ";" due to Power BI local configurations):

carlos_vale_0-1627299571472.png

carlos_vale_1-1627299689805.png

When I have all options selected on the slicers or only one option like "TBA" in System, the measure Mod Filter always returns "Remove". I've included a table to check the Mod Filter return (image below)

carlos_vale_2-1627299880321.png

carlos_vale_3-1627299937201.png

carlos_vale_4-1627300053368.png

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors