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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
azaterol
Helper V
Helper V

Negate values in column

Hello everyone,

I would like to negate all numbers in the column that contain the status 1 and 2.

Current:

 

Status

Number

15
419
18
210

 

According to the formula:

StatusNumber
1-5
419
1-8
2-10

 

I already have this formula in M for the number 1, but it doesn't work. Where is my mistake in thinking?


= Table.ReplaceValue(#"ReplacedValue",each [Number], each if [Status]=1 then each [Number] * -1 else [Number],Replacer.ReplaceValue,{"Number"})


I thank you for your help.

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @azaterol 

You have an extra keyword each before [Number] * -1

Try this instead:

 

= Table.ReplaceValue(#"ReplacedValue",each [Number], each if [Status]=1 then [Number] * -1 else [Number],Replacer.ReplaceValue,{"Number"})

 

 

Also, you could handle Status 1 and 2 in the same step if you want, for example:

 

= Table.ReplaceValue(#"ReplacedValue",each [Number], each if [Status]=1 or [Status] = 2 then [Number] * -1 else [Number],Replacer.ReplaceValue,{"Number"})

 

 Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

1 REPLY 1
OwenAuger
Super User
Super User

Hi @azaterol 

You have an extra keyword each before [Number] * -1

Try this instead:

 

= Table.ReplaceValue(#"ReplacedValue",each [Number], each if [Status]=1 then [Number] * -1 else [Number],Replacer.ReplaceValue,{"Number"})

 

 

Also, you could handle Status 1 and 2 in the same step if you want, for example:

 

= Table.ReplaceValue(#"ReplacedValue",each [Number], each if [Status]=1 or [Status] = 2 then [Number] * -1 else [Number],Replacer.ReplaceValue,{"Number"})

 

 Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.