
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
colour a negative value that is positive in red
Hi I am new to qlik, i am trying to make a graph that represents negative and positive values, I have succeeded with the expression:
= if(count(product) > 0, green(),
if(Fabs(count(product) > 0) * -1, red())))
My problem is that I don't know how to paint the negative values, since they are not negative values as such, because I have forced them with the Fabs() *-1 function.
Does anyone know how to colour those positive values converted to negative values? as shown in the img
- Tags:
- qliksense
- Subscribe by Topic:
-
Chart
-
Developers
-
expression
-
filter
-
General Question
-
Set Analysis
-
Variables
-
Visualization
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you've got 2 measures and one dimension.
Make the measures master items and set the colour for them the chart will take care of the rest on Auto.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, what if you paint your positive values green and all other red without additional IF? Like:
if(count(product) > 0, green(), red())

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello justISO, thank you for your reply.
I was using Fabs, because I don't have negative values, I convert positive values into negative, that's why I can't use those 'false negatives' when colouring the < 0, because they are not really less than 0, but a multiplication by -1.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then I don't quite understand why you make a negative value out of the count() function. Maybe you can provide little sample of data you are using? Because, count(product) always provide positive result (as it is counting number of rows of your product), fabs basically convert true clause to number, *-1, so with expression
= if(count(product) > 0, green(), if(Fabs(count(product) > 0) * -1, red())))
you paint positive values green and again, same values you try to paint red. But as first if() is true, your all graphs should be green? Or not?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using two measures, one for positive values: count(if(product >0,customers))
for negative values, its measure is: Fabs(count(if(product<0,customers))) *-1
In this expression I convert the positive values in negative, I have tried to put the same expressions in the colour section, but it paints everything in green because it detects that they are all positive, when I force the negatives I don't know how to make it detect the 'false negatives' and paint them in red.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
and your dimension 'product' is number?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, is number

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
then maybe it is better to use sum() instead of count()? And suggestion (for color, not for calculation of customers) if(sum(product) > 0, green(), red()) should work I guess

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you've got 2 measures and one dimension.
Make the measures master items and set the colour for them the chart will take care of the rest on Auto.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you very much, it was just what I needed!!

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