Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Austin360
Regular Visitor

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 

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

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}})

View solution in original post

3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

@Syndicate_Admin  @Austin360

You can multiply by -1

Mira_Ghaly_0-1648106721486.png

 

Vijay_A_Verma
Super User
Super User

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}})

use Transform, Standard> Multiply -1

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors