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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Rich_Wyeth
Helper I
Helper I

Removing Rows with Certain Values

Hi all,

 

I have set up some filters on my Data which don't appear to work.

Below is what I have done, one by one removing any data with the Month named in the column.

I have followed on the sequence from each month, so would expect this to have worked at the end. However, when I close and apply and search fror "JAN", my data is still returning rows. seems to be doing it for each month, I thought I had removed.

 

Should I be doing something different?

 

The remove 0 part at the top of the sequence, does work.

 

 

#"Remove 0 Price" = Table.SelectRows(#"Only Previous Month", each ([Price] <> 0)),
#"Remove CONS - JANUARY" = Table.SelectRows(#"Remove 0 Price", each not Text.Contains([Cust PO Number], "JAN") or not Text.Contains([Cust PO Number], "JANUARY")),
#"Remove CONS - FEBRUARY" = Table.SelectRows(#"Remove CONS - JANUARY", each not Text.Contains([Cust PO Number], "FEB") or not Text.Contains([Cust PO Number], "FEBRUARY")),
#"Remove CONS - MARCH" = Table.SelectRows(#"Remove CONS - FEBRUARY", each not Text.Contains([Cust PO Number], "MAR") or not Text.Contains([Cust PO Number], "MARCH")),
#"Remove CONS - APRIL" = Table.SelectRows(#"Remove CONS - MARCH", each not Text.Contains([Cust PO Number], "APR") or not Text.Contains([Cust PO Number], "APRIL")),
#"Remove CONS - MAY" = Table.SelectRows(#"Remove CONS - APRIL", each not Text.Contains([Cust PO Number], "MAY")),
#"Remove CONS - JUNE" = Table.SelectRows(#"Remove CONS - MAY", each not Text.Contains([Cust PO Number], "JUN") or not Text.Contains([Cust PO Number], "JUNE")),
#"Remove CONS - JULY" = Table.SelectRows(#"Remove CONS - JUNE", each not Text.Contains([Cust PO Number], "JUL") or not Text.Contains([Cust PO Number], "JULY")),
#"Remove CONS - AUGUST" = Table.SelectRows(#"Remove CONS - JULY", each not Text.Contains([Cust PO Number], "AUG") or not Text.Contains([Cust PO Number], "AUGUST")),
#"Remove CONS - SEPTEMBER" = Table.SelectRows(#"Remove CONS - AUGUST", each not Text.Contains([Cust PO Number], "SEPT") or not Text.Contains([Cust PO Number], "SEPTEMBER")),
#"Remove CONS - OCTOBER" = Table.SelectRows(#"Remove CONS - SEPTEMBER", each not Text.Contains([Cust PO Number], "OCT") or not Text.Contains([Cust PO Number], "OCTOBER")),
#"Remove CONS - NOVEMBER" = Table.SelectRows(#"Remove CONS - OCTOBER", each not Text.Contains([Cust PO Number], "NOV") or not Text.Contains([Cust PO Number], "NOVEMBER")),
#"Remove CONS - DECEMBER" = Table.SelectRows(#"Remove CONS - NOVEMBER", each not Text.Contains([Cust PO Number], "DEC") or not Text.Contains([Cust PO Number], "DECEMBER"))
in
#"Remove CONS - DECEMBER"

1 ACCEPTED SOLUTION
wardy912
Super User
Super User

The issue in your code is the use of the or operator in your Text.Contains conditions.

 

each not Text.Contains([Cust PO Number], "JAN") or not Text.Contains([Cust PO Number], "JANUARY")

 

This will always return true unless the value contains both "JAN" and "JANUARY" at the same time:

 

If [Cust PO Number] contains "JAN" but not "JANUARY", the second condition is true, so the whole expression is true.
If it contains "JANUARY" but not "JAN", the first condition is true, so again the whole expression is true.
So the row is not removed.


You should use and instead of or to ensure the row is removed if it contains either "JAN" or "JANUARY".

 

#"Remove CONS - JANUARY" = Table.SelectRows(#"Remove 0 Price", each not Text.Contains([Cust PO Number], "JAN") and not Text.Contains([Cust PO Number], "JANUARY")),
#"Remove CONS - FEBRUARY" = Table.SelectRows(#"Remove CONS - JANUARY", each not Text.Contains([Cust PO Number], "FEB") and not Text.Contains([Cust PO Number], "FEBRUARY")),


Please give a thumbs up if this fixes your issue.

View solution in original post

2 REPLIES 2
Rich_Wyeth
Helper I
Helper I

Thank you, that has resolved the issue.

 

wardy912
Super User
Super User

The issue in your code is the use of the or operator in your Text.Contains conditions.

 

each not Text.Contains([Cust PO Number], "JAN") or not Text.Contains([Cust PO Number], "JANUARY")

 

This will always return true unless the value contains both "JAN" and "JANUARY" at the same time:

 

If [Cust PO Number] contains "JAN" but not "JANUARY", the second condition is true, so the whole expression is true.
If it contains "JANUARY" but not "JAN", the first condition is true, so again the whole expression is true.
So the row is not removed.


You should use and instead of or to ensure the row is removed if it contains either "JAN" or "JANUARY".

 

#"Remove CONS - JANUARY" = Table.SelectRows(#"Remove 0 Price", each not Text.Contains([Cust PO Number], "JAN") and not Text.Contains([Cust PO Number], "JANUARY")),
#"Remove CONS - FEBRUARY" = Table.SelectRows(#"Remove CONS - JANUARY", each not Text.Contains([Cust PO Number], "FEB") and not Text.Contains([Cust PO Number], "FEBRUARY")),


Please give a thumbs up if this fixes your issue.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.