Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to a string field with () designating negative into a num type?

Hi community,

Is there a simple way or does anyone have anyway to turn negative strings with () into -.

example of field data:

      9056

    11209

(495)

(44245)

    49300

14 Replies
Nicole-Smith

You have to change the Format Pattern on the Number tab:

Capture.PNG

For example, change ###########,### to ###########,###;-###########,### for a -

or change ###########,### to ###########,###;(###########,###) for ()

nstefaniuk
Creator III
Creator III

Hi you can use:

Num#(replace(replace('(14)', '(', '-'), ')', ''))

Put your field instead of '(14)' in the formula.

Not applicable
Author

That is exactly what I had done but it still gives me text data type.  I go from:

(4302)

    5069

    7869

to:

-4302

   5069

   7869

nstefaniuk
Creator III
Creator III

When you say "text data" you mean the display in a chart is the display used for text ?

nstefaniuk
Creator III
Creator III

In my test it works.

Please find below

Not applicable
Author

I'm not sure what type the data is, but in a list box it aligns the way text data is supposed to. Other numbers align to the right.

Not applicable
Author

Here's my document

nstefaniuk
Creator III
Creator III

Ok got it.

Remove the "," too when you replace the "( )".

Not applicable
Author

Sorry can you show me the correct code.  I don't see an extra ,