Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

madeleine_josef
Contributor

Turning negative values red

Hi,

How can I turn the negative values in one of my columns red?

Can I write something in the format pattern?

Thanks.

/ Madeleine

8 Replies
priyalvp24
Contributor

Re: Turning negative values red

Hi,

In your Background Color expression write

If(datafield<0,red())

Thanks,

Priyal

Re: Turning negative values red

Depends on the type of chart but in tables you can set the Text Color Expression or Background Color Expression to something like RGB(255,0,0)

Any expression valid in Qlik which returns a color with RGB() or ARGB() will work.

Highlighted
madeleine_josef
Contributor

Re: Turning negative values red

Hi Miguel,

I tried writing RGB(255,0,0) in the Text color expression but then all numbers turned red. How can I turn only the negative numbers red?

/ Madeleine

priyalvp24
Contributor

Re: Turning negative values red

Hi,

In your Background Color expression write

If(datafield<0,red())

Thanks,

Priyal

madeleine_josef
Contributor

Re: Turning negative values red

Hi,

This doesn't seem to work for me as my net amount column is a master item and not a datafield.

/ Madeleine

Re: Turning negative values red

As mentioned above, using any expression which returns a color will work, in your case:

If(Sum(Sales) < 0, Red(), Black())

Assuming Sum(Sales) is your expression.

madeleine_josef
Contributor

Re: Turning negative values red

The column is biult up by a master item so your suggestion sadly doesn't work.

The app was created by a consultant and I thought that I could just make the change in the format pattern or text color expression.

Re: Turning negative values red

You can click on the link icon on the item to remove it from the master library and see the expression. You can still use the expression to change the color, but you need to know the expression, of course.