Forum Discussion

vanessafvg's avatar
vanessafvg
Community Champion
8 years ago
Solved

Issue with text filtering in M / Power Query

when i do this

 

= Table.SelectRows(#"Unpivoted Only Selected Columns", each Text.Contains([Attribute], "Column") or Text.Contains([Attribute], "Total"))

 

its keep all the rows that contain column or total

 

however when i do the opposite, ie i want to filter these out it still brings them back, what am i doing wrong?

  • vanessafvg's avatar
    vanessafvg
    8 years ago

    v-jiascu-msft hi dale, thanks but what i  meant i did both (including the not),  it wasn't working, the issue was actually i should have used and and not or, i had multiple conditions, that solved the problem

     

     

2 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi vanessafvg,

     

    That's because the "Text.Contains([Attribute], "Column") or Text.Contains([Attribute], "Total")" returns TRUE. These rows are kept finally. Please try it like below.

    result = Table.SelectRows(#"Changed Type", each not ( Text.Contains([Attribute], "Column")  or Text.Contains([Attribute], "Total")))
    

    Issue_with_text_filtering_in_M

     

    Best Regards,

    Dale

    • vanessafvg's avatar
      vanessafvg
      Community Champion

      v-jiascu-msft hi dale, thanks but what i  meant i did both (including the not),  it wasn't working, the issue was actually i should have used and and not or, i had multiple conditions, that solved the problem