Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mahitham
Creator II
Creator II

Covert to negatvie values

Hi Experts,

Can any one please help me on below requirement.

I have a bar chart with below expression

if( RowNo()= 1, column(1), column(1) - above(column(1)) )


The bar chart contains some negative and some positive values. please help me to convert all the values as negative.

By using fabs function we can convert to all as positive values. Is there any way to convert all values as negative.

fabs(if( RowNo()= 1, column(1), column(1) - above(column(1)) ))


Thanks in advance


10 Replies
petter
Partner - Champion III
Partner - Champion III

Put a minus in front of the FAbs() function.

     -fabs(if( RowNo()= 1, column(1), column(1) - above(column(1)) ))

mahitham
Creator II
Creator II
Author

Hi petter-s

Thanks for your reply

I have to show all gains as positive above the middle line and all loss measures as negative the corresponding bars as below the middle line.

But when its zero values for loss measures its showing on top is there any way to convert the zero values also negative and get 2017 loss to bottom.

mahitham
Creator II
Creator II
Author

Hi stalwar1,

Could you please help me to covert 2017 loss measure 0 value to negative 0 value.

The expression used for that measure is

-1 * (fabs(if( RowNo()= 1, column(1), column(1) - above(column(1)) )))

sunny_talwar

You want to convert 0 to -0? but I don't think there is a thing such as -0

but if you just need - in front of your expression... then may be try this

'-' & (fabs(if( RowNo()= 1, column(1), column(1) - above(column(1)) )))

or

Dual('-' & (fabs(if( RowNo()= 1, column(1), column(1) - above(column(1)) ))), (fabs(if( RowNo()= 1, column(1), column(1) - above(column(1)) ))))

mahitham
Creator II
Creator II
Author

Hi Sunny,

Thanks for your reply.

I have tried the above expression but those are not working.

Is there any way to remove the 0 values from the bar chart. I have unchecked Include Zero values under Add-ons but those are not removed

sunny_talwar

Do you just one measure or do you have more than one measure in your chart?

sunny_talwar

Also, are you also using some kind of text before the expression?

mahitham
Creator II
Creator II
Author

I have more than one measure total 4 measures

sunny_talwar

So, is it possible that one of the 4 measures have a value other than 0 when the above measure has 0 value? If that is true... then because of the 4 expressions have non zero value... unchecking include zero value is not going to help