Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
BSCIknowlec
Contributor III
Contributor III

Visual cue when variable is within a certain value

Hi experts, hoping someone can help me.

I'm looking to have a visual cue/ color change when the following happens....

I have a variable named "new" and a variable named "old". I want my text box/expression to go green when the difference between the new and old variable is less than 3.02, else it is red. 

My "new" variable is a calculation and my "old" variable is a manual entry by the customer. 

i assume is it just an if statement within the visual cue/ background color? any ideas would be appreciated.

thank you,

Ciarán

Labels (4)
1 Solution

Accepted Solutions
rubenmarin

Hi, you can use an expression like: If(fabs(($(oldVarName))-($(newVarName)))<3.02, Green(), Red())

This can be in the background color or in the font color.

Fabs() is to consider absolute value of the difference, you can remove if you only want to validate positive changes.

View solution in original post

5 Replies
rubenmarin

Hi, you can use an expression like: If(fabs(($(oldVarName))-($(newVarName)))<3.02, Green(), Red())

This can be in the background color or in the font color.

Fabs() is to consider absolute value of the difference, you can remove if you only want to validate positive changes.

BSCIknowlec
Contributor III
Contributor III
Author

Hi Rubenmarin,

thank you for your response. I tried your suggestion but it didn't seem to work for me:.

this is your expression with my variables:

BSCIknowlec_0-1602837801017.png

 

then my "UGBL"(old) variable is dynamic so the user can enter in whatever they want:

BSCIknowlec_1-1602837865817.png

 

then the calculated UGBL(new variable) in my table should go green/red, but it doesn't. any ideas?

BSCIknowlec_2-1602837926200.png

 

thanks

benvatvandata
Partner - Creator II
Partner - Creator II

Just making sure, you are entering that formula into either the Background Color or Text Color property of the expression?

benvatvandata_0-1602868689310.png

 

What other fields are in your table (if any)?

 

BSCIknowlec
Contributor III
Contributor III
Author

im entering it in both but not seeing any changes in the output of the text

Brett_Bleess
Former Employee
Former Employee

You may have typo in your variable from what I noticed, calculated is spelled caluclated, that may be why it is not working....

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.