Forum Discussion

linoybar's avatar
linoybar
Frequent Visitor
9 years ago
Solved

m query remove character from column in a table

Hi, I'm very new to Power BI and learning now M language. My question is: which formula would remove a specific character in a table? For example, I have this code:   let Source = Excel.Workbook...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Text.Remove doesn't take a column as the input. It takes a text value. Read the documentation on it. It's not meant to operate on full columns. It's meant to operate on a single text value. I can't tell you how to use Text.Remove on a column because that's not what that function is for. It is not the correct function to use in order to reach the outcome you want. Wrong tool for the job. And  by the way, ASKING THE SAME QUESTION A SECOND TIME IN ALL CAPS DOESN'T CHANGE THE ANSWER.

     

    If you're hellbent on using that particular function for some reason, I suppose you could use it in a new column definition formula where you copy the text values from each row in another column, then use Text.Remove to remove those letters. But that leaves you with two columns, one with o's, one without. So you'll probably find that answer unacceptable too.

     

    If you want to reference a column in M code, you have to use a formula that takes a column as an argument. Perhaps something like Table.ReplaceValue...

     

     

    The interface option, as you call it, just generates M code. You can use the Replace Values button or you can type this code by hand. They are literally the same thing, except one of them takes longer to do.