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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
bobbydave
Creator III
Creator III

Red Amber else Default

I am writing some code at the moment to say that

When a value is higher than its target, the value turns green and when a value is less than its target, value turns red.

But what if there is no target, the values should stay default (black).

=if(

(if(Unit = '%', num(avg([Value]), '#,##0%'),

   if(Unit = 'Days', num(avg([Value]), '#,##0'),

  num(sum(Target), '#,##0'))))

>= 

(if(Unit = '%', num(avg(Target), '#,##0%'),

   if(Unit = 'Days', num(avg(Target), '#,##0'),

  num(sum(Target), '#,##0')))),

  

  vGreen, vRed)

Is there a way of adding if target is blank, the values stay black

TargetValueValue
573
638
77
1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

just manage the first expression

If(IsNull(sum(Target),

View solution in original post

4 Replies
alexandros17
Partner - Champion III
Partner - Champion III

something like this:

=If(IsNull(sum(Target), rgb(255,255,255),

if(

(if(Unit = '%', num(avg(
[Value]), '#,##0%'),

if(Unit = 'Days', num(avg(
[Value]), '#,##0'),

num(sum(Target), '#,##0'))))

>=

(if(Unit = '%', num(avg(Target), '#,##0%'),

if(Unit = 'Days', num(avg(Target), '#,##0'),

num(sum(Target), '#,##0')))),



vGreen, vRed)
)

bobbydave
Creator III
Creator III
Author

Doesnt seem to like that.

alexandros17
Partner - Champion III
Partner - Champion III

just manage the first expression

If(IsNull(sum(Target),

giakoum
Partner - Master II
Partner - Master II

why don't you use visual cues?