Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
March 11, 2PM EST: Do More with Qlik - Getting Started wtih Qlik Sense SaaS - Redux. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
etrotter
Creator II
Creator II

Relative Text Color expression

Hi,

is it possible to write a relative text color expression? For example:

I would like if my expression is 5% below  target it to be red,

if it is 5% higher or lower than the Target it to be yellow,

and if it is 5% higher than it to be green.

is this possible? if so how would you write such an expression?

Thanks!

1 Solution

Accepted Solutions
vvira1316
Specialist II
Specialist II

Were you able to change it to your need?

=If(Sum(Met_Goal_Flag)/Count(Met_Goal_Flag)>(Target*(1.05)), RGB(0,255,0),

If((Sum(Met_Goal_Flag)/Count(Met_Goal_Flag)>=(Target*(0.95)) and

(Sum(Met_Goal_Flag)/Count(Met_Goal_Flag)<=(Target*(1.05)))), RGB(255,255,0),

If(Sum(Met_Goal_Flag)/Count(Met_Goal_Flag)<(Target*(0.95)), RGB(255,0,0)

)

)

)

I hope brackets in this one are right.

If so, can you please close the thread.

View solution in original post

10 Replies
agigliotti
Partner
Partner

what's the qlik sense object are you talking about?

felipedl
Partner
Partner

Hi erica,

If you mean the KPI object, there are the bellow options to do that (my limit is 200k, so above that green and up arrow, bellow that, red and down arrow).

KPI.png

KPI.png

etrotter
Creator II
Creator II

The object is a chart, and I want to make the background of a field change colors

vvira1316
Specialist II
Specialist II

Hi Erica,

is it something similar to following thread

syntax to color text in a calculated column

etrotter
Creator II
Creator II

if(Sum(Met_Goal_Flag)/Count(Met_Goal_Flag)>(Target+(.05*Target)),'green', if(Sum(Met_Goal_Flag)/Count(Met_Goal_Flag)>(Target-(.05*Target)),'yellow','red'))

So I think I'm close, but it still isn't working properly. if the value is higher than the target it is returning red

vvira1316
Specialist II
Specialist II

try this

if(Sum(Met_Goal_Flag)/Count(Met_Goal_Flag)>(Target*(1.05)),'green',

if(Sum(Met_Goal_Flag)/Count(Met_Goal_Flag)>=(Target*(0.95))

and (Sum(Met_Goal_Flag)/Count(Met_Goal_Flag)<=(Target*(1.05)),'yellow',

'red'))

etrotter
Creator II
Creator II

Now only the yellow is working

vvira1316
Specialist II
Specialist II

Would you be able to provide me your sample data/app?

vvira1316
Specialist II
Specialist II

=If(Sum({<[Month/Year]={'8/1/2017'}>}COMM1) > 30, RGB(0,255,0),

If((Sum({<[Month/Year]={'8/1/2017'}>}COMM1) >= 10 and

(Sum({<[Month/Year]={'8/1/2017'}>}COMM1) <= 30)), RGB(255,255,0),

If(Sum({<[Month/Year]={'8/1/2017'}>}COMM1) < 10, RGB(255,0,0)

)

)

)

Color.PNG

It was bracketing issue