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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change the colour of the Bars based on % of Fail?

Hi,

I have bar chart with

Dimension: Member_SheetA

Expression: Count({<Result={'Fail'}>} Distinct Reference_SheetA)/Count(Distinct(Reference_SheetA))

Show the chart will show the % of Fail items for each Member

Is it possible to change the color of the bars i,e if the Member fails 100% it should show in RED, if the Member fails 50 % it should show in Green , if Member fails less than 40 % it should show in Blue and so on?

Please can anyone suggest me.

Thanks in advance.

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

GO TO Expression

Click on + sign

Type below in Background Color expression

=IF(Column(1)='100%',RED(),

IF(Column(1)<='50%',GREEN(),

IF(Column(1)<='40%',BLUE())))

View solution in original post

7 Replies
Not applicable
Author

Please find attached.

amit_saini
Master III
Master III

Hi Ameila,

Please follow the link:

http://community.qlik.com/message/470385#470385

Thanks,

AS

veidlburkhard
Creator III
Creator III

Hi Amelia,

use this expression for the background color of your expression:

If(

Count({<Result={'Fail'}>} Distinct Reference_SheetA)/Count(Distinct(Reference_SheetA)) > 0.5, LightRed(),

if(Count({<Result={'Fail'}>} Distinct Reference_SheetA)/Count(Distinct(Reference_SheetA))<= 0.5, LightGreen(), LightBlue())

)

Color.jpg

Hope this is ok for you

Burkhard

ThornOfCrowns
Specialist II
Specialist II

Put in the Background colour of your expression: 

=if(Count({<Result={'Fail'}>} Distinct Reference_SheetA)/Count(Distinct(Reference_SheetA))<=.50,Green(),Red())

In this case, if your target is less than or equal to 50%, the bar is Green, otherwise it's Red. Use as many nested IFs to cover your boundaries.

MK_QSL
MVP
MVP

GO TO Expression

Click on + sign

Type below in Background Color expression

=IF(Column(1)='100%',RED(),

IF(Column(1)<='50%',GREEN(),

IF(Column(1)<='40%',BLUE())))

maxgro
MVP
MVP

if I understand you can

put the color expression in background color (adapt color to your need)

if(Count({<Result={'Fail'}>} Distinct Reference_SheetA)/Count(Distinct(Reference_SheetA))=1, rgb(255,0,0),

if(Count({<Result={'Fail'}>} Distinct Reference_SheetA)/Count(Distinct(Reference_SheetA))>=0.5, rgb(0,255,0),

if(Count({<Result={'Fail'}>} Distinct Reference_SheetA)/Count(Distinct(Reference_SheetA))>=0.4, rgb(0,0,255),

rgb(0,0,0))))

or use colormix wizard

Not applicable
Author

Thanks. Perfect