Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Setting a value to a negative number

Deano478
12 - Quasar

Hi everyone,

 

This might be simple but I just cant see a way to actually do it: I have a use case where I need to set all numbers less than 0 to -0.

 

I have no idea if that's actually possible but any insights would be great.

5 REPLIES 5
JosephSerpis
17 - Castor
17 - Castor

Hi @Deano478 you can multiple your numeric values by -1 and that should do the trick. If you have multiple numeric columns that you need to apply this to you can use a Multi-Field Formula Tool.

DataNath
17 - Castor

Hey @Deano478, if you need to have the negative sign beforehand then you'll need to output the result as a string. If not then you can just change the output data type to numeric and it'll switch to just 0:

 

DataNath_0-1675334768487.png

DataNath_1-1675334806685.png

ShankerV
17 - Castor

Hi @Deano478 

 

One way of doing this.

 

ShankerV_0-1675335933307.png

 

Input was:

ShankerV_1-1675335949538.png

 

As -0 is not INT type, I have just replaced with -1 so that we don't want to have change the data type.

 

Hope it helps!!!!

 

IF [Field1]<0
THEN -1
ELSE [Field1]
ENDIF

ShankerV_2-1675336054632.png

 

 

Many thanks

Shanker V

 

Raj
16 - Nebula

According to me the formula tool will be the best option to go with.

Deano478
12 - Quasar

Cheers guys for the various approaches I was able to blend them together and get the desired results 

Labels