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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Color for text box expression outcome

Hi there,

Currently I am facing problems giving the outcome of my expression in the textbox the right color. The expression shows the realization compared to the budget in %. I wish to make the percentage outcome <0 red and >0. Until now I couldn't get it done and I am out of inspiration. I hope someone could give me a hand. The statement so far is:

=Num((1-((-sum({<[Categorie]= {'DIENST' } >} [Budget Bedrag] )-sum({<[Categorie]= {'LICENTIE' } >} [Budget Bedrag] )-sum({<[Categorie]= {'ONDERHOUD' } >} [Budget Bedrag] )-sum({<[Categorie]= {'OPLEIDING' } >} [Budget Bedrag] )-sum({<[Categorie]= {'Overige omzet' } >} [Budget Bedrag] )-sum({<[Categorie]= {'REIS' } >} [Budget Bedrag] )-sum({<[Categorie]= {'OVERIG' } >} [Budget Bedrag] )))

/

(-sum({<[Categorie]= {'DIENST' } >} [Bedrag] )-sum({<[Categorie]= {'LICENTIE' } >} [Bedrag] )-sum({<[Categorie]= {'ONDERHOUD' } >} [Bedrag] )-sum({<[Categorie]= {'OPLEIDING' } >} [Bedrag] )-sum({<[Categorie]= {'Overige omzet' } >} [Bedrag] )-sum({<[Categorie]= {'REIS' } >} [Bedrag] )-sum({<[Categorie]= {'OVERIG' } >} [Bedrag] )))
,',#%')

Best Regards,

Roy Covalenco

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

See this example. Change the loaded data in the script and see what happens with the two text boxes.

Good luck,

Peter

View solution in original post

8 Replies
alexandros17
Partner - Champion III
Partner - Champion III

In the text box properties select "General" tab, then in the "Background" area select color and paste your formula in calculated text box area in this way:

If(myExpression < value, RGB(255,0,0),

If(myExpression = value, RGB(0,255,0),

RGB(0,0,255)

)

)

hope it helps

Not applicable
Author

Thanks for your fast response, it seems that it won't work together with my expression somehow. The "outcome" of my text box is now the RGB value.

Not applicable
Author

You need to have an = sign before your expresision

= If .........

Not applicable
Author

Thanks, but that was already added by me. The outcome given by the expression provided by Alessandro is "RGB(255,0,0)" when using just <0 and when using both <0 and =0 in the same expression the value is " - ". I hope somebody knows how to solve my problem . Thanks for your advice.

Best Regards,

Roy Covalenco

Peter_Cammaert
Partner - Champion III
Partner - Champion III

In a text box, there are three qualities you can change in the Properties dialog:

  • the text displayed: See General->Foreground->Text. If the above formula works, then leave it as is.
  • the foreground (text) color: See Font->Color, click the color button and select a fixed color or a Calculated value in the field on the right
  • the background (text area) color: See General->Background->Color, click the color button and select a fixed color or a Calculatyed value i nthe field on the right. This is what Alessandro suggested. Dit you use that technique?

If you put the expression in one of the two Calculated color fields, there will always be a color, never a '-'.

BTW I think you can change your formula into the following less bulky version:

=Num(1-(sum({<[Categorie]= {'DIENST', 'LICENTIE', 'ONDERHOUD', 'OPLEIDING', 'Overige omzet', 'REIS', 'OVERIG' } >} [Budget Bedrag] )

/

sum({<[Categorie]= {'DIENST', 'LICENTIE', 'ONDERHOUD', 'OPLEIDING', 'Overige omzet', 'REIS', 'OVERIG' } >} [Bedrag] ))
,',#%')

Edit: further simplified the above expression. Replace myExpression both times with this expression but first strip the leading equal sign and the Num() call.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

See this example. Change the loaded data in the script and see what happens with the two text boxes.

Good luck,

Peter

Not applicable
Author

Peter,

I totally missed your responce, either way thanks a lot . It was helpful.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Glad it was.

Please close the discussion by marking an answer as correct (and some others as helpful). That way community visitors can find topic discussions that do actually contain an answer to their questions (the blue balloon will turn green = answered). Thanks.