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
bipolarminds
Frequent Visitor

Filter rows in matrix by matches with another column

I am given a datatable table1 with a column named postal_code. I created a matrix with rows being given by distinct values in postal_code. However, I would like to exclude some of these rows in the matrix, specifically those values in postal_code that do not appear in a column postal_code2 of a different table, say table2.

Is this possible?

1 ACCEPTED SOLUTION

Hi @bipolarminds ,

 

Please try new a measure like:

Measure = 
VAR _table = INTERSECT(DISTINCT('Table1'[postal_code1]),DISTINCT('Table2'[postal_code2]))
VAR _filter = IF(SELECTEDVALUE('Table1'[postal_code1]) IN _table,1)
RETURN
_filter

and apply it to the matrix's filter:

vcgaomsft_0-1673933940694.png

attach the pbix file for reference.

 

Best Regards,
Gao

Community Support Team

 

If 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

View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

hi @bipolarminds 

you can filter the postal_code column with a slicer or in the filter pane, or?

Thx for your answer! I'd rather not exclude the values manually since the data is getting updated on a regular basis. Isn't there a way to say 'only show those values which can be found in table2[postal_code2]'?

Hi @bipolarminds ,

 

Please try new a measure like:

Measure = 
VAR _table = INTERSECT(DISTINCT('Table1'[postal_code1]),DISTINCT('Table2'[postal_code2]))
VAR _filter = IF(SELECTEDVALUE('Table1'[postal_code1]) IN _table,1)
RETURN
_filter

and apply it to the matrix's filter:

vcgaomsft_0-1673933940694.png

attach the pbix file for reference.

 

Best Regards,
Gao

Community Support Team

 

If 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

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.

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