Forum Discussion

Austin360's avatar
Austin360
Regular Visitor
4 years ago
Solved

Converting all positive values in a column to negative values.

Hello everyone.

 

Please I need help on how to convert positive values within a column to negative values. 

 

Thanks 

  • Assuming Data is column name

    In a Custom column, you can put following formula

    =if Number.Sign([Data])=1 then -1*[Data] else [Data]

     

    if you don't want to use Custom column but want to do it in-place column, then next step is

    =Table.TransformColumns(#"Changed Type",{{"Data", each if Number.Sign(_)=1 then -1*_ else _}})

     

    Here you will need to replace #"Changed Type" with your previous step

     

    If your column has all positive values only, 

    = Table.TransformColumns(#"Changed Type", {{"Data", each _ * -1}})

5 Replies

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    Assuming Data is column name

    In a Custom column, you can put following formula

    =if Number.Sign([Data])=1 then -1*[Data] else [Data]

     

    if you don't want to use Custom column but want to do it in-place column, then next step is

    =Table.TransformColumns(#"Changed Type",{{"Data", each if Number.Sign(_)=1 then -1*_ else _}})

     

    Here you will need to replace #"Changed Type" with your previous step

     

    If your column has all positive values only, 

    = Table.TransformColumns(#"Changed Type", {{"Data", each _ * -1}})

    • kbarua's avatar
      kbarua
      New Member

      use Transform, Standard> Multiply -1

    • Shal_R's avatar
      Shal_R
      New Member

      over complicated

      just multiply by -1

      • Vijay_A_Verma's avatar
        Vijay_A_Verma
        Most Valuable Professional

        This is a good approach if all values are known to be positive. If there are negative values also, then those negative values will become positive if we multiply by -1.