
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to show negative values in bar chart
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.
- « Previous Replies
-
- 1
- 2
- Next Replies »


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The solution presented by @jonathandienst should work.
Please see my attached qvw.
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Qlik Community MVP


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- « Previous Replies
-
- 1
- 2
- Next Replies »