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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DJH1
New Member

How to filter a column from items in another dataset column

I have two datasets and I want to filter a column in the first dataset against matching items in a column in the second dataset they are both string columns.  I'm trying to build a visual that will show all the items in the dataset 1 column that do not contain items from dataset 2 column.

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

You should be able to use List.Contains to filter the table. 
Consider the example data...
itemTable

jgeddes_0-1708971360362.png

criteriaTable

jgeddes_1-1708971384791.png

you can select rows from itemTable that are not in the criteriaTable adding this line to itemTable

 

= Table.SelectRows(PREVIOUSSTEP, each not List.Contains(Table.ToList(crtiteriaTable), [Item]))

 

jgeddes_2-1708971555579.png

 


if you wanted to select rows that matched the criteria, you would remove the 'not' from the above code.
Hope this gets you pointed in the right direction.
 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

4 REPLIES 4
jgeddes
Super User
Super User

You need to replace 'PREVIOUSSTEP' with the actual previous step in your table. It may look something like #"Changed Type".





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Jonvoge
Super User
Super User

Hi DJH1

 

You may also consider using a Merge action.

Perform a Left Join, and filter out the subsequent rows where columns from Dataset 2 are empty, meaning that no corresponding item was found.

_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.

jgeddes
Super User
Super User

You should be able to use List.Contains to filter the table. 
Consider the example data...
itemTable

jgeddes_0-1708971360362.png

criteriaTable

jgeddes_1-1708971384791.png

you can select rows from itemTable that are not in the criteriaTable adding this line to itemTable

 

= Table.SelectRows(PREVIOUSSTEP, each not List.Contains(Table.ToList(crtiteriaTable), [Item]))

 

jgeddes_2-1708971555579.png

 


if you wanted to select rows that matched the criteria, you would remove the 'not' from the above code.
Hope this gets you pointed in the right direction.
 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





I'm running into an error inputting the code into the table the "PREVIOUSSTEP" portion in the code is not a selectable option an errors when I input it manually.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.