Forum Discussion

MichaelF1's avatar
MichaelF1
Helper III
3 years ago
Solved

Power query text methods

Hi everyone,

 

How do I apply a text method in M code to a whole column?

 

I have 

ColumnAColumnB
1abcFred
2abcJane
3Markabc
4Jamabces
5Emmabca

 

I want

ColumnAColumnB
1Fred
2Jane
3Mark
4James
5Emma

 

I know that I can use this method: 

Text.Remove(text as nullable text, removeChars as any) as nullable text

But I can't work out what to put as the arguments if I want the function to work over a whole column.

 

Thanks 

 

 

 

 

 

  • In the query editor, select your column and click on Replace Values in the ribbon. Just leave the 2nd field blank.

     

    Pat

  • Try this one= Table.ReplaceValue(#"Changed Type","abc","",Replacer.ReplaceText,{"Column2"})

     

    Hope this helps!

2 Replies

  • ppm1's avatar
    ppm1
    Solution Sage

    In the query editor, select your column and click on Replace Values in the ribbon. Just leave the 2nd field blank.

     

    Pat

  • Try this one= Table.ReplaceValue(#"Changed Type","abc","",Replacer.ReplaceText,{"Column2"})

     

    Hope this helps!