Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

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: 
Not applicable

Color by Expression in a Stacked Bar Chart in Qlik Sense

Hello,

PLEASE HELP!!! I have googled and youtubed looking for help and haven't found it....

    

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.

It seems so simple but I can't figure it out. Please help ASAP! Thanks!

1 Solution

Accepted Solutions
mgranillo
Specialist
Specialist

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

View solution in original post

5 Replies
mgranillo
Specialist
Specialist

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
Author

Can you just write in your color by expression

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

Not applicable
Author

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
Author

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

lavanyakat
Contributor II
Contributor II

Hi,

I have tried the same colour expression:

if([AMHP Out of Hours Y/N] ='Yes',black(),if([AMHP Out of Hours Y/N] ='No',green(), red()))

However as you can see from the attached image, the expression is not working on the stacked bar chart.

The 2 Measures I have for the stacked chart are:

1) SUM({<[AMHP Count Referral]={1}, [AMHP Out of Hours Y/N] ={'Yes'}>} [AMHP Count Referral])

2) SUM({<[AMHP Count Referral]={1}, [AMHP Out of Hours Y/N] ={'No'}>} [AMHP Count Referral])

Thanks,

Lav