
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
font color expression
hi everyone,
I have a text box which calculates the % change between Budget and Actual. If the % change is negative, I want the font to be red. If it is positive, I want it to be green.
My expression in the text box to calculate % change is working fine: =num((sum(Budget)/sum(Actual)-1),'#.#0%'). However, I cannot get the calculated font color to work. Here's my expression:
=if((sum(Budget)/sum(Actual)-1)>0,'Green','Red')
Any ideas on how to fix the syntax are appreciated!
- Tags:
- new_to_qlikview
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
The codes that Rebecca posted had a translucency value of zero - which would have made your text transparent. You could make those first values 255, or not use the colour codes with the translucency modifier, eg.
RGB(0,128,0) and RGB(128, 0, 0)
I find these functions more simple to understand anyway, as everyone expects just R, G and B values.
The other thing worth noting that as you have a very simple criteria you could ignore the Font Color expression and do this using the Visual Cues tab. This way you can define which colours should be shown based on the value of the field - and you get to use the colour picker dialog. There are lots of situations where you do need to use the font colour expression though.
Hope that helps,
Steve


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
go to font, then color
then calculate and do.
if(sum(Budget)/sum(Actual)-1)>0,argb(255,0,255,0),argb(255,255,0,0))
hope that helps you.
regards.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you- works like a charm!


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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
though i do have a question - would there be a way to change the shades of red and green? I would ideally have wanted a darker set of colors but typing in their RGB codes didn't do it for me.
more specifically, the green i wanted was RGB (0,128,0) and the red was (128,0,0)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You only need to modify the RGB color expression!
ARGB(0,0,128,0) and ARGB(0,128,0,0)
Rebeca

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sadly that just wiped out my text thanks for the idea though!


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
The codes that Rebecca posted had a translucency value of zero - which would have made your text transparent. You could make those first values 255, or not use the colour codes with the translucency modifier, eg.
RGB(0,128,0) and RGB(128, 0, 0)
I find these functions more simple to understand anyway, as everyone expects just R, G and B values.
The other thing worth noting that as you have a very simple criteria you could ignore the Font Color expression and do this using the Visual Cues tab. This way you can define which colours should be shown based on the value of the field - and you get to use the colour picker dialog. There are lots of situations where you do need to use the font colour expression though.
Hope that helps,
Steve

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you both!!
