# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

## Color by Expression in a Stacked Bar Chart in Qlik Sense

Hello,

The problem ....

Dimension - (Drill-down) Regional Training, BC , Dist, Dealer Code

Measure - Count of Students that have a "Y" status and a Count of Students that have a "N" status:

Measure 1 = Count({\$<[LEVEL 1 COMPLETION]={"Y"}>} distinct SID)

Measure 2 = Count({\$<[LEVEL 1 COMPLETION]={"N"}>} distinct SID)

I want to be able to write an expression (if that is the easiest way) to color by measure... N = Red and Y = Green.

1 Solution

Accepted Solutions
Contributor III

## Re: Color by Expression in a Stacked Bar Chart in Qlik Sense

Try moving [LEVEL 1 COMPLETION] as your second dimension (so you'll have two dimensions: drilldown and [LEVEL 1 COMPLETION]), make your expression Count(distinct SID), and enter your color expression as if([LEVEL 1 COMPLETION]='Y',green(),if([LEVEL 1 COMPLETION]='N',red()))

4 Replies
Contributor III

## Re: Color by Expression in a Stacked Bar Chart in Qlik Sense

Try moving [LEVEL 1 COMPLETION] as your second dimension (so you'll have two dimensions: drilldown and [LEVEL 1 COMPLETION]), make your expression Count(distinct SID), and enter your color expression as if([LEVEL 1 COMPLETION]='Y',green(),if([LEVEL 1 COMPLETION]='N',red()))

Not applicable

## Re: Color by Expression in a Stacked Bar Chart in Qlik Sense

Can you just write in your color by expression

If([LEVEL 1 COMPLETION]='Y',Green(),Red())

Not applicable

## Re: Color by Expression in a Stacked Bar Chart in Qlik Sense

THANK YOU!!!!!!!!!

It worked! You have no idea how much I appreciate your help and knowledge.   I changed the color expression to - if([LEVEL 1 COMPLETION]='Y',green(),red()) but your guidance got me to where I needed to go! Huge help! You Rock!

Not applicable

## Re: Color by Expression in a Stacked Bar Chart in Qlik Sense

Yes, that expression worked but I needed to first get the dimension and drill-down to be positioned correctly. Thanks for your help!