Power Query Forum - Filter with "Text.Contains"

SSibbett 21 Reputation points
2020-12-02T17:42:54.137+00:00

Hello,

I am trying to filter out other files that will have random names and only focus on the files that have "Data" in their file name. I though the way to do this is by naming the files and say in Power Query the "Text.Contains". I feel like this should work because the filter is just a list of true and false, but this logic does not work on the row "Filtered Rows"

let
    Source = Folder.Files("C:\File\Path\Location"),
    #"Filtered Rows" = Table.SelectRows(Source, each ([Extension] = ".xlsx") and (Text.Contains([Name],"Data") )
in
    #"Filtered Rows"
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,525 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lz._ 8,991 Reputation points
    2020-12-02T18:23:32.027+00:00

    Hi @SSibbett

    This works no problem here assuming the number of closing parentheses is OK:

     let  
         Source = Folder.Files("C:\File\Path\Location"),  
         #"Filtered Rows" = Table.SelectRows(Source, each ([Extension] = ".xlsx") and (Text.Contains([Name],"Data")))  
     in  
         #"Filtered Rows"  
    

    Could you confirm and if this solves your problem please mark this reply as answer to help others with a similar issue - Thanks


0 additional answers

Sort by: Most helpful