Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

joshakehurst
New Contributor III

Colors with Custom Expression on Null values

I would like to use a custom expression to display a Green/Red color output on a donut chart, but nothing is working.  I define anything null in the field as 'Unassigned' otherwise 'Assigned'.  Here are the expressions involved. 

Dimension

=if(IsNull([Resolution]), 'Unassigned', 'Assigned' )

Colors and Legend

=if(IsNull([Resolution), RGB(72,196,117), RGB(231,97,74))

Also tried

=if(IsNull([Resolution]), RGB(72,196,117), if(Not isNull([Resolution]), RGB(231,97,74), RGB(0,0,0)))

The only color displayed is Green (Not red for the Unassigned/Null values)

Screen Shot 2017-09-14 at 4.02.49 PM.png

1 Solution

Accepted Solutions
rajeshthakur292
Contributor II

Re: Colors with Custom Expression on Null values

Or may be this -

Dimension - Aggr(if(isnull([Resolution]),'Unassigned','Assigned'),[Field])

and in the color by expression -

if(Aggr(if(isnull(Resolution),'Unassigned','Assigned'),[Field])='Unassigned',RGB(72,196,117), RGB(231,97,74))

5 Replies
shraddha_g
Honored Contributor III

Re: Colors with Custom Expression on Null values

try,

Pick(wildmatch(if(IsNull([Resolution]), 'Unassigned', 'Assigned' ), 'Unassigned', 'Assigned'),

RGB(72,196,117), RGB(231,97,74)

)

rajeshthakur292
Contributor II

Re: Colors with Custom Expression on Null values

Hi Josh, Shraddha,

I am not sure why both of your expressions are not working.May be you can make some change to the load script.

Please check the attached app.

Cheers.

shraddha_g
Honored Contributor III

Re: Colors with Custom Expression on Null values

Once you use this in Load script you don't have to apply isnull() again in front end.

if you are using

if(IsNull([Resolution]), 'Unassigned', 'Assigned' ) as Resolution

in Load script.

You color by expression changes to pick(wildmatch(Resolution, 'Unassigned', 'Assigned'),

RGB(72,196,117), RGB(231,97,74)

)

Check Rajesh's modified app

rajeshthakur292
Contributor II

Re: Colors with Custom Expression on Null values

Or may be this -

Dimension - Aggr(if(isnull([Resolution]),'Unassigned','Assigned'),[Field])

and in the color by expression -

if(Aggr(if(isnull(Resolution),'Unassigned','Assigned'),[Field])='Unassigned',RGB(72,196,117), RGB(231,97,74))

joshakehurst
New Contributor III

Re: Colors with Custom Expression on Null values

This is a very strange approach, but it works.  Thanks for the tip. 

Community Browser