Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
Hi, what if you paint your positive values green and all other red without additional IF? Like:
if(count(product) > 0, green(), red())
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.
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?
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.
and your dimension 'product' is number?
yes, is number
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
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.
thank you very much, it was just what I needed!!