Alteryx Designer Desktop Discussions

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

Negative numbers converting to null

Usamah22
8 - Asteroid

hello,

 

i have a column with numbers which is currently a string. when i convert it to a double to do calculations the negative values (as below) are being lost and set as null. how can i resolve this?

 

Usamah22_0-1615550667506.png

 

2 REPLIES 2
pedrodrfaria
13 - Pulsar

Hi @Usamah22 

 

This function using the formula tool before changing the data type will fix the error for you.

 

If you only have negative values:

 

Replace(Replace([Field], "(" ,"-"), ")", "")

 

pedrodrfaria_0-1615551224640.png

pedrodrfaria_1-1615551231790.png

 

If you have positive as well, you can do something like this:

 

 

if contains([Field], "(" ) then

Replace(Replace([Field], "(" ,"-"), ")", "") else

[Field] endif

 

 

Pedro

Qiu
20 - Arcturus
20 - Arcturus

@Usamah22 
Maybe we can do like this.

New Workflow6.PNG

Labels