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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
amien
Helper V
Helper V

filter based on comparison of the columns

If i have two fields : X and Y. Both integer.

 

I can filter one of them with the filter option. But what if would like to filter on this : WHERE X > Y

how can i do this? I would like to do this in M. And without creating a new column with the difference between X and Y, and filter on this.

 

Thanks in advanced.

2 REPLIES 2
MattAllington
Community Champion
Community Champion

When you say 2 fields, do you mean 2 columns?  If you want to do this in Power Query (M as you say), then you will need a new column. But it doesn't have to be the difference between the 2 columns. Just add a new column something like this. 

 

if [X] > [Y] then 1 else 0

 

then just filter when this column equals 1. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Hi there,

If you want to avoid adding a column as an intermediate step, you could also use a logical expression to filter based on multiple columns such as:

= Table.SelectRows(OriginalTable , each [X] > [Y] )

Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors