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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Not able to do the multi conditional filter in power query

I have table called prodcut table. I want to filter the table on the basis of conditions in dfferenet colunmn. For the same record in one column one condition and in another column another condition.My first condition is in [Product_ID] column and another condition is in [Pain Attribute 5] column.But when I am using filtering on the bsis of this condition MCode is appliying only the first condition .This means if the are two records with same Product_ID but with different Pain Attribute 5 , These two records are getting delted in the filter .My M code looks like this :

#"Filtered Rows1" = Table.SelectRows(#"Renamed Columns2", each [Product_ID] <> "311789" and [#"Pain Attribute 5"] <> "Not Found"),

 

I want remove the [Product_ID] = "311789" and [Pain Attribute 5] ="Not Found"

But my code remove all [Product_ID]  with "311789" without considering my second conditon [Pain Attribute 5] ="Not Found"

I need help to get the correct filter Mcode.

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

The easiest way is to deselect the values you wish to exclude in the dropdown in each of the relevant column headers filters. 

 

If you want to exclude rows where both conditions are met, you can create a new conditional column to create a flag and then filter rows by the flag. You then delete the flag column as the last step.

To create the Conditional Column you can use something along the lines of:

 

#"FlaggedRows" = Table.AddColumn(#"Renamed Columns2", "FlaggedRows", each if [Product_ID] <> "311789" and [#"Pain Attribute 5"] <> "Not Found" then "Flag" else null),

 

This will create a new column with "Flag" for rows where both conditions are not met. You can then filter the column for "Flag" and delete the FlaggedRows column as the last step.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

1 REPLY 1
PaulDBrown
Community Champion
Community Champion

The easiest way is to deselect the values you wish to exclude in the dropdown in each of the relevant column headers filters. 

 

If you want to exclude rows where both conditions are met, you can create a new conditional column to create a flag and then filter rows by the flag. You then delete the flag column as the last step.

To create the Conditional Column you can use something along the lines of:

 

#"FlaggedRows" = Table.AddColumn(#"Renamed Columns2", "FlaggedRows", each if [Product_ID] <> "311789" and [#"Pain Attribute 5"] <> "Not Found" then "Flag" else null),

 

This will create a new column with "Flag" for rows where both conditions are not met. You can then filter the column for "Flag" and delete the FlaggedRows column as the last step.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors