Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Changing colours depending on variable's value

Hello everyone,

I got a problem with design. I want to change Text Object font colours dynamically:

This is how I've set expression in Calculated option field for three colours:

=IF($(vMarginDiff)<0 AND $(vMarginDiff)>=-3,

               RGB(251,219,36),

         IF($(vMarginDiff)>=0.0, RGB(131,165,61),RGB(210,29,19)))


This expression is not changing colours of font (only if I use IF statement without ELSE it works, but its not enought at all)

Variable is fine, it returns  the number of similar format like this 0,156946.

Can it be done like this or I just want too much?

here is the pic for better imagination (correct value of variable is in "Marže" box)

THANK YOU!

MP

1 Solution

Accepted Solutions
Not applicable

Re: Changing colours depending on variable's value

Thx for an idea!

I have replaced the dot instead of comma with replace function so IF contition, works properly. Thank you very much!

=REPLACE(num(sum({<[Data.Typ položky]={"Deník"},[CSM strom-účty.Level3]={"Tržby zboží","Náklady                                         zboží"}>}Data.Částka/1000)/

                    ), '##'), ',' , '.' )

6 Replies
Employee
Employee

Re: Changing colours depending on variable's value

Whats the value of $(vMarginDiff)?

It returns 0,156946 with a coma?

Not applicable

Re: Changing colours depending on variable's value

Thx for an idea!

I have replaced the dot instead of comma with replace function so IF contition, works properly. Thank you very much!

=REPLACE(num(sum({<[Data.Typ položky]={"Deník"},[CSM strom-účty.Level3]={"Tržby zboží","Náklady                                         zboží"}>}Data.Částka/1000)/

                    ), '##'), ',' , '.' )

rank_nandha
Contributor II

Re: Changing colours depending on variable's value

Hi Michal,

Make sure your font expression is like this

=IF ($(vMarginDiff)>=0.0, RGB (251,219,36), IF ($(vMarginDiff)<0 AND $(vMarginDiff)>=-3, RGB(131,165,61), RGB(210,29,19)))

Also i have attached a sample please refer that. Hope this helps you to solve your problem.

Regards,

Nandha

joaquinlr
Valued Contributor II

Re: Changing colours depending on variable's value

Hi Michal:

Have you tried IF ($vmarginDiff) >= 0 ....

Regards

Joaquín

Employee
Employee

Re: Changing colours depending on variable's value

Would you mind giving me a "Helpful Answer"? Thanks in advance

Not applicable

Re: Changing colours depending on variable's value

I think problem was in IF statement, where comma in nubmer was used as one of the conditions.

Ive had statement basically like:

IF(14,2545, RGB1, RGB2); co I could never reach else statement. When I used REPLACE and changed comma to dot, it worked.

But I dont get this behaviour at all...

Community Browser