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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
zenisekd
Super User
Super User

Advanced filtering in power query - multiple conditions

Hi all, 
I bumped into a puzzle that I do not understand...

 

In power query I have two columns - State (that gives values Cancel, Sales, etc..) and Confirmation Date (gives null or specific date).

 

I want to filter all rows that contain at the same time Cancel and null. I tried to use Filter Rows - advanced filter and .... it doesnt work. It filters all Cancel and all nulls ... I cant see why... I am not sure about the code, but the logic in the user interface function should clearly work this way, but it doesnt .... or am I missing something?

 

I managed to find another way to filter the rows, by adding new column and then filtering by it... but I would like to do it in one easy step... not three. Can somebody tell me what is going on?

 

= Table.SelectRows(#"Added Custom", each [public.sale_order.confirmation_date] <> null and [state] <> "cancel")

 

zenisekd_0-1612346232443.png

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this instead

 

= Table.SelectRows(#"Added Custom", each not ([public.sale_order.confirmation_date] = null and [state] = "cancel"))

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this instead

 

= Table.SelectRows(#"Added Custom", each not ([public.sale_order.confirmation_date] = null and [state] = "cancel"))

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thanks. I have been having the same problem.

I have a table where Number column and Amount column have numerical values. If both values are zero ("0"), I want them filtered out.  But if one of them has a non-zero value, I want the line retained. Below is the advanced filter.
Capture.PNG

The Advanced Filter creates the following, which does not give me the desired result:

= Table.SelectRows(#"Expanded MasterTBL", each [Number] <> 0 and [Amount] <> 0)

 

Using the solution above, I've altered the filter to be (changes highlighted):

= Table.SelectRows(#"Expanded MasterTBL", each not ([Number] = 0 and [Amount] = 0))

This solution works. Thanks 🙂

You are the boss, sir 🙂 

However, do you think, that the user interface window just doesn't function properly (giving incorrect code), or am I doing something wrong?

 

Thanks

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.