Forum Discussion

ovetteabejuela's avatar
ovetteabejuela
Impactful Individual
9 years ago
Solved

PowerQuery: Replace Value (Dashes)

Hi Again,

 

I'm trying to replace a value - a DASH particularly. It works, however it also does remove the dash symbol for negative numbers. How do I prevent M from doing that?

  • Hi ovetteabejuela,

     

    Is the negative number part of a longer peice of text? 

     

    Could you create a custom column to preserve the negative number before cleaning your original column?

3 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Microsoft Employee

    Hi ovetteabejuela,

     

    Is the negative number part of a longer peice of text? 

     

    Could you create a custom column to preserve the negative number before cleaning your original column?

    • ovetteabejuela's avatar
      ovetteabejuela
      Impactful Individual

      Hi Phil_Seamark, thanks I actually did resort to that solution store (1,-1) in a separate column prior to removing dashes. I hope there was an option to tick to exclude dashes that precedes a number though - an out-of-the-box solution.

       

      Thanks.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Transform the number to text and replace the dash "-" with "-0". After this convert the column to a number. The "-0" will be converted to 0 and all other numbers will remain the same, since adding a "0" in front of a number will not affect the value of it.