Alteryx Designer Desktop Discussions

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

How to show parentheses in a negative number

Edu
7 - Meteor

Hi all,

 

What is the best practice to add the parentheses in a negative number to be "-40,000" to be "(40,000)"?

 

I'm new to this tool and appreciate your help.

 

Thank you in advance

10 REPLIES 10
DavidP
17 - Castor
17 - Castor

I would do it with a formula like this

 

negative number.png

Edu
7 - Meteor

Hi DavidP

 

 

 

sushantsane
5 - Atom

@DavidP

 

How do we do this when we have the number in 'double' format? Its giving me an error saying - Error: Formula (18): The formula "" resulted in a string but the field is numeric. Use ToNumber(...) if this is correct. (Expression #1)

 

Using ToNumber doesnt help as it converts the string to 0.

DavidP
17 - Castor
17 - Castor

Hi @sushantsane 

 

Numeric formats such as Double does not support brackets or 1000 separators. You therefore have to change the data type to a string first.

sushantsane
5 - Atom

That does not work. Since the if statement expects a number to use, throwing up error that it needs the data in number format !

DavidP
17 - Castor
17 - Castor

Hi @sushantsane 

 

In my example above, the field [number] is a numeric datatype - double would work here - but the field [new number] is a Text data type, since you're adding non-numeric characters.

 

[new number] is the new field created in the formula tool.

 

I'm guessing that there might actually be 2 errors in the formula tool:

 

1. When I see double quotes "" it usually suggests that a new field is being created in a formula tool, but that a name for the new field was not entered

2. The results of the if statement is a Text value, but the datatype of the new field is specified as a numeric type such as Double.

 

If you can attach your workflow, I can take a look.

 

 

OliviaYoY
6 - Meteoroid

Hi DavidP, 

 

Thanks for sharing the formula. I am wondering how to convert the negatif number as indicated in the exemple to (40 000) without ",". 

 

Thanks for your insights ! 

 

Best 

Olivia 

OliviaYoY
6 - Meteoroid

[Solved] for anyone has the same issue as me, please refer to this solution. 

https://community.alteryx.com/t5/Forum-Francais/separateur-de-milliers/td-p/408445#

 

Best

Olivia

Jimmylee4real
8 - Asteroid

thank you so much! I try to use the same formula but there is an error showing "resulted in a string but the field is numeric...Use ToNumber() if this is correct. May I know what shall I do to solve this data type error? 

 

Fyi, my current data type should be "double"

 

thanks!

Labels