none
Replace Values wild card RRS feed

  • Question

  • I just want to replace anything value in a column that contains the word "Contract" with "Contract".  So, I really want to do is replace any value in the column that contains the word "Contract" with just "Contract".  I haven't found any answer to a question previously that I can understand how to accomplish this.

    The statement that gets generated after the above is executed.  Is there a way to put multiple values in the text to find?  Is there a wildcard character? 


    Thanks.

    Saturday, February 22, 2020 1:39 PM

Answers

  • Hi Robert

    Assuming [BS] is of Type text at PreviousStepName the following should do it:

        Replaced = Table.TransformColumns(PreviousStepName ,
            {
                {"BS", each
                    if Text.Contains(_, "contract", Comparer.OrdinalIgnoreCase)
                    then "Contract"
                    else _,
                type text
                }
            }
        )
    
    For more complex scenario see Imke's Multiple replacements or translations in Power BI and Power Query article

    Nice day..

    Saturday, February 22, 2020 3:45 PM

All replies