Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

amit_saini
Honored Contributor III

Change negative to () help.!!!

Hi Folks ,

I need to covert all negative numbers in my pivot table to () for example -8.3 should appear as ()8.3. Any idea how to do it.

At present my number format is #.##0,0

Thanks in Advance.!!!

1 Solution

Accepted Solutions
rustyfishbones
Honored Contributor II

Re: Change negative to () help.!!!

you could use FABS Function around the Expression.

or change the number format to

'#.##0,0;(#.##0,0)'

9 Replies
rustyfishbones
Honored Contributor II

Re: Change negative to () help.!!!

you could use FABS Function around the Expression.

or change the number format to

'#.##0,0;(#.##0,0)'

Not applicable

Re: Change negative to () help.!!!

hi,

Try using

if(Sum(exp)<0, '()'&fabs(sum(exp)), sum(exp))

HTH

-Shruti

cabhijit
Valued Contributor

Re: Change negative to () help.!!!

use below:

Replace(FieldName,'-','()')

for simple presentation change. It won't affect total sums.

Not applicable

Re: Change negative to () help.!!!

As Alan said, modify your number format.

expression for >0 number ; (semi colon) expression for < 0 numbers

so you will have:

num(your exp, '#,##0.0;(#,##0)', '.', ',')

Fabrice

Not applicable

Re: Change negative to () help.!!!

hi

try to use fabs() function

example-

='()' & fabs(-8.3)

then output is

()8.3

hope this helps you.

sudeepkm
Valued Contributor III

Re: Change negative to () help.!!!

Type the number format  like below

negativeformat.png

nareshguntur
Valued Contributor

Re: Change negative to () help.!!!

Hi Amit,

Why don't you use

=if(Sum(Sales)<0,'('&Sum(Sales)&')',Sum(Sales)).

Cheers,

Naresh

amit_saini
Honored Contributor III

Re: Change negative to () help.!!!

Thanks Alan it worked fine .

rustyfishbones
Honored Contributor II

Re: Change negative to () help.!!!

Hi Amit,

Please mark the answer as Correct and also any other helpful answers, it will help other users find the answers they are looking for too

Thanks

Alan