Skip to main content

App Development

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

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $400 before Dec 31st: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
joshakehurst
Partner - Contributor III
Partner - 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
Neymar_Jr
Creator II
Creator II

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))

View solution in original post

5 Replies
shraddha_g
Partner - Master III
Partner - Master III

try,

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

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

)

Neymar_Jr
Creator II
Creator II

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
Partner - Master III
Partner - Master III

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

Neymar_Jr
Creator II
Creator II

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
Partner - Contributor III
Partner - Contributor III
Author

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