Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
peterstalberg
Contributor III
Contributor III

How to add +, - and +/- in number formating?

Hi,

I have a table with positiv, negative and 0 values (Input). I would like to format them as Output in the table.

The formula num([Input], '+# ##0;-# ##0;+/-0')  works for positive and 0 values but not for negative values as per Error in the table.  What is wrong here? RGDS//Peter

Input Output Error
5 000 +5 000 +5 000
0 +/-0 +/-0
-5 000 -5 000 -+5 000

 

Labels (1)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

as below

num(Input,if(Input=0,'+/-#,###','+#,###;-#,###'))  as formattedInput

 

vinieme12_0-1669358116443.png

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

3 Replies
vinieme12
Champion III
Champion III

as below

num(Input,if(Input=0,'+/-#,###','+#,###;-#,###'))  as formattedInput

 

vinieme12_0-1669358116443.png

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
peterstalberg
Contributor III
Contributor III
Author

Thank you for the help! This works but I'm still puzzled why my proposal num([Input], '+# ##0;-# ##0;+/-0') doesn't do the trick....?!?

vinieme12
Champion III
Champion III

num() only accepts 2 params

1st - the value to be formatted

2nd -  ' <format for +ve values> ;   <format for -ve values> '

 

in your expression, you are trying to specify formats for 3 values(+ve,-ve and 0)  which is not possible

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.