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
LoryMenCR
Helper I
Helper I

Double condition for a column filtering in powerquery

Dear All,

i'm struggling to define a double condition for a column filtering in powerquery.

I need to filter out from the table when there is a specific value in one column AND another specific value in another column.

Let's say I have the following table:

FruitNumberColor
Apple2Blue
Banana3Yellow
Grapes0Orange
Watermelon0Black

I need to filter out rows where there is "0" in Number column and "Orange" in Color column, so I get the following table:

FruitNumberColor
Apple2Blue
Banana3Yellow
Watermelon0Black

 

Do you have any idea?
Thanks a lot

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @LoryMenCR - In Power query editor,based on two conditions, you can use the Filter Rows feature with a custom filter or use M code directly

 

This should effectively remove the row with Number = 0 and Color = "Orange".

 

rajendraongole1_1-1723188769392.png

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WciwoyElV0lEyAmKnnNJUpVidaCWnxDwgBIoYA3Fkak5OfjlY3L0osSC1GChmAMT+RYl56RD14YklqUW5qTn5eVA5p5zE5Gyl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Fruit = _t, Number = _t, Color = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Fruit", type text}, {"Number", Int64.Type}, {"Color", type text}}),
#"FilteredRows" = Table.SelectRows(Source, each not ([Number] = "0" and [Color] = "Orange"))
in
#"FilteredRows"

 

Hope it works





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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @LoryMenCR 
you can create a custom column in power query with condition 

 

 

RemoveRow = if [Value] = 0 and [Color] = "Orange" then "Remove" else "Keep"

 

 

 

then you can filter out the "Remove" from the RemoveRow column. This will keep only the rows where the condition Value= 0 and Color= "Orange" is not satisfied.

rajendraongole1
Super User
Super User

Hi @LoryMenCR - In Power query editor,based on two conditions, you can use the Filter Rows feature with a custom filter or use M code directly

 

This should effectively remove the row with Number = 0 and Color = "Orange".

 

rajendraongole1_1-1723188769392.png

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WciwoyElV0lEyAmKnnNJUpVidaCWnxDwgBIoYA3Fkak5OfjlY3L0osSC1GChmAMT+RYl56RD14YklqUW5qTn5eVA5p5zE5Gyl2FgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Fruit = _t, Number = _t, Color = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Fruit", type text}, {"Number", Int64.Type}, {"Color", type text}}),
#"FilteredRows" = Table.SelectRows(Source, each not ([Number] = "0" and [Color] = "Orange"))
in
#"FilteredRows"

 

Hope it works





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

Proud to be a Super User!





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