Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

dan-ketil
Contributor II

Setting background color

Hi

I want to set the background color based on an expersion result.

After googling and trial and error I am at a stand still with errors...

This is basicly what I want to do

If((sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)) >= 4.5, LightRed(),

    If((sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)) < 4.5, Brown(),   

            If((sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)) < 3.0, LightGreen(),

                    If((sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)) < 1.0, LightBlue()

                        ,Yellow())

                   

                )

       )

)

But it ony return the first parameter correct. Those that fit into >= 4.5 is correct, all the rest stopped at second check and turns brown

To make sure it understood the between settings I changed it. Andalso just in case it was sequential I also changed the order.

But still the same resul. >= 4.5 is ok, the rest now is either Lightblue or yellow.

//Alle som er over 4.5

If((sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)+0.000000001) >= 4.5, LightRed(),

//Alle som er mindre mellom 0.9 og 0.1

    If((sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)+0.000000001) <= 0.9 or (sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)+0.000000001) >= 0.1, LightBlue(),   

   

//Alle som er mindre mellom 2.9 og 1.0

            If((sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)+0.000000001) <= 2.9 or (sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)+0.000000001) >= 1, Green(),

           

//Alle som er mindre mellom 4.5 og 3.0           

                    If((sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)+0.000000001) < 4.5 or (sum(TO_EACH)/sum({$<UOM={'PL'}>} RATIO_DEN)+0.000000001) > 3, Brown()

                   

//Alt annet                   

                        ,Yellow())

                   

                )

       )

)

Any suggestions on how to solve?

BR Dan

1 Solution

Accepted Solutions

Re: Setting background color

I think that your condition is wrong:

the first "IF" sequence choose between >=4,5 and <4,5, all other values are excluded because the condition <4,5 is yet satisfied.

To set intervals you have to (for instance):

If(Cond >=4,5, Red

     if (Cond<4,5 AND Cond >=3, Green,

          if((Cond >=1 AND Cond <3, Blue, White

     )

)

Hope it helps.

Alexandros

View solution in original post

2 Replies

Re: Setting background color

I think that your condition is wrong:

the first "IF" sequence choose between >=4,5 and <4,5, all other values are excluded because the condition <4,5 is yet satisfied.

To set intervals you have to (for instance):

If(Cond >=4,5, Red

     if (Cond<4,5 AND Cond >=3, Green,

          if((Cond >=1 AND Cond <3, Blue, White

     )

)

Hope it helps.

Alexandros

View solution in original post

dan-ketil
Contributor II

Re: Setting background color

Thanks. Worked like a charm.

BR

Dan