Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
We have a bar chart and my requirement is i need to show all the values(positive and negative) in Y axis and on the same direction.
So i used these code in the expression to get the chart
=fabs(sum ({$<dim={'abc'}>}xxx)) - converting negative values with absolute values. Please see the screen shot attached, and distinguishing negative values with red color and positive value with green color.
Now i need to show the '-' sign if the value is negative however the chart bar should be on the y axis same direction as it is .
so my requirement is to display the '-' if it is negative. Is there way to do it.
To display a - sign for the negatives while keepin the absolue value, use a dual:
=Dual(sum ({$<dim={'abc'}>}xxx), fabs(sum ({$<dim={'abc'}>}xxx)))
To set the colours, exapnd the background property of the expressions (click the + next to the expression on the expressions tab). Use the expression:
If(sum ({$<dim={'abc'}>}xxx) < 0, red(), green())
(Adjust your colours to taste)
Hi John, Thank you for the quick reply. I changed the formula as you suggested.
=Dual(sum ({$<dim={'abc'}>}xxx), fabs(sum ({$<dim={'abc'}>}xxx)))
Seems like it did not do anything. I also tried #,##0#,-##0 in number tab .
Did now work .
I also try this in expression
=num(Dual(sum ({$<dim={'abc'}>}xxx), fabs(sum ({$<dim={'abc'}>}xxx))),'#,##0','-#,##0') and then in number made it expression default. But did not workout.
Any thought.
Thank you,
The solution presented by @jonathandienst should work.
Please see my attached qvw.
Hi Vegar,
Thank you for your reply. Yes i see your qvw is working fine. Some how mine is not. Not sure where is the problem though.
The expressions I posted explained the pattern for the expression - they will not work like that, you need to fill out the expression details which you did not supply in your original post.
Hi Jontydpki,
Thank you for your reply. My original expression is
=fabs(sum ({$<L3={'ATTRIB'}>}Sales))
Please let me know if you need more info. Thank you again.
Kind regards,
Ashis Sau