Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculated Colours

Hi,

I'm trying to assign dynamic background colours, but

=Red(Score*255)

won't work. I tried

=if(Score>0.5,Red(255),Red(50))

and that's fine, but surely I don't need to have 50 if statements to get more shades of Red?

Thanks!
Oli

1 Solution

Accepted Solutions
eduardo_sommer
Partner - Specialist
Partner - Specialist

Use instead

     =RGB(Score*255,0,0)

Eduardo

View solution in original post

8 Replies
Not applicable
Author

Are you trying to dynamically change the colors in a table based on the cell value vs a standard?  If so,  click the "+" next to your expression and select background color, then enter your expression to define the behavior.

Then you'd have one if statement for your whole table

Not applicable
Author

I'm doing exactly that. That's not the problem though - the problem is that =Red(Score*255) doesn't work and I don't want to give 255 if statements for every shade of red. Score=1 should be Red(255), Score=0 should be Red(0), but QlikView can't cope with calculations in Red() apparently.

Not applicable
Author

See this post http://community.qlik.com/blogs/qlikviewdesignblog/2012/12/04/colors-in-charts

You'll want to basically make a color definition table based on the score.

Not applicable
Author

Try using the colormix wizard.

eduardo_sommer
Partner - Specialist
Partner - Specialist

Use instead

     =RGB(Score*255,0,0)

Eduardo

jerem1234
Specialist II
Specialist II

As Jacob Kean says, Use colormix wizard,

Go to the background color of your expression, then go to File in the upper left hand corner and choose Colormix Wizard..., then put the expression in (such as Score) then choose the upper and lower limit color. Finish the wizard and it will spit out a formula that should shade your backgrounds.

Expression.PNG.pngColor.PNG.png

Hope this helps!

EDIT: Attached is an example using Colormix wizard

Not applicable
Author

Thank you! Surely that's a bug that needs fixing...

Anonymous
Not applicable
Author

Yes, I would also use an RGB expression instead, and assure the (Score x 255) returns values between 1 and 255.

The red(x) does not actually give shades of red, but red with different alpha values/different oppacities which might give a slightly different result.

If Score has more than one value per line/bar etc., you will probably end up with black lines/bars, if you don't take care of this in the calculation.