Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Advanced Filter "Contains" Caps Sensitive

Hello,

 

I have designed a report that has a table with a field "Item Description". Some descriptions have been entered as all CAPS while others are all lower case. For example RED BALL vs Blue Ball. In this example, I set up an advanced filter, "contains" on the description, "Ball" and only the second result is displayed, while a filter for "BALL" displays only the first result.

 

Is there a way I can indicate that this field is not case sensitive, or can filter without case sensitivity??

 

Thank you in advance,

 

Michael

  • If you mean in Power Query, then yes:

    • Before the filter, transform that column to be either all upper, lower, or proper. Whatever you want, but then it is consistent.

    Unfortunately, Table.SelectRows doesn't seem to support Comparer.OrdinalIgnoreCase as an argument. With Table.Distinct, for example, you can do this:

     

    = Table.Distinct(#"Changed Type", Comparer.OrdinalIgnoreCase)

    and it ignores case.

6 Replies

  • edhans's avatar
    edhans
    Icon for Community Champion rankCommunity Champion

    If you mean in Power Query, then yes:

    • Before the filter, transform that column to be either all upper, lower, or proper. Whatever you want, but then it is consistent.

    Unfortunately, Table.SelectRows doesn't seem to support Comparer.OrdinalIgnoreCase as an argument. With Table.Distinct, for example, you can do this:

     

    = Table.Distinct(#"Changed Type", Comparer.OrdinalIgnoreCase)

    and it ignores case.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi edhans 

       

      Thank you for your response.

       

      Do you have a solution that is compatible with DirectQuery?

       

      Michael

      • edhans's avatar
        edhans
        Icon for Community Champion rankCommunity Champion

        Not sure exactly what you mean. Case transformations are supported by Direct Query, at least for SQL Server. This works fine - see the Lowercased Text statement below:

         

        let
            Source = Sql.Database("localhost", "AdventureWorks2017"),
            Production_ProductModel = Source{[Schema="Production",Item="ProductModel"]}[Data],
            #"Lowercased Text" = Table.TransformColumns(Production_ProductModel,{{"Name", Text.Lower, type text}})
        in
            #"Lowercased Text"

         

  • v-lid-msft's avatar
    v-lid-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Based on my test, it can filter without case sensitive if you are use in Page Filter or Visual Filter:

     

     


    BTW, pbix as attached.

     

    Best regards,

    Community Support Team _ Dong Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      I am encountering issues strictly with DirectQuery. My import models are not affected...

      • edhans's avatar
        edhans
        Icon for Community Champion rankCommunity Champion

        What are the issues? Can you post a sample of your M-Code that breaks direct query? Just the source, one column, and your transformation.