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 achieved this 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 image.
If ther eare 2 different measures, one positive and one negative, you can create a master item for each and assign the measure color in the master item, then on chart use the master items as measures and select the option to use library colors on Layout -> presentation ->colors and legend
Hi, I don't know why you use the fabs, have you tried this?:
= if(count(product) > 0, green(),
if(count(product) < 0, red()))
Or just: = if(count(product) > 0, green(), red())
Hello Ruben, 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.
can you post the Chart Expression instead?
If count(product) is higher than zero it will go with the first condition and there will be only green bars or zero bars, so something else is creating that negative bars. Use the same expression that gives values to the bars to color the bars.
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.
If ther eare 2 different measures, one positive and one negative, you can create a master item for each and assign the measure color in the master item, then on chart use the master items as measures and select the option to use library colors on Layout -> presentation ->colors and legend