Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
somilkaushik
Contributor
Contributor

Coloring issue in qliksense barchart

I'm trying to color a stacked bar chart with red and green and I'm unable to do so I have tried to do it using color by expression. And here are some scripts I've tried:

//Color(IF(training_status = 'Completed', RGB(0, 255, 0)), IF(training_status = 'Pending', RGB(255, 0, 0)))

//=if(TRAINING_STATUS='Completed', RGB(0, 255, 0), RGB(255, 0, 0))
//IF(Count({<TRAINING_STATUS={'Pending'}>} TRAINING_STATUS) > 0, '#4477aa', (IF(Count({<TRAINING_STATUS={'Completed'}>} TRAINING_STATUS) > 0, '#ddc800',) ))
//IF(MeasureName = 'Count(if(TRAINING_STATUS=''Pending'', TRAINING_STATUS))', '#4477aa')
IF(TRAINING_STATUS='Completed', RGB(0, 128, 0), IF(TRAINING_STATUS='Pending', RGB(255, 0, 0)))

 

Labels (3)
4 Replies
F_B
Creator III
Creator III

Hi @somilkaushik and welcome to Qlik Community.

It would be easier to set your status Pending and Completed as master items, and then in their properties, associate them the colors you like.

somilkaushik
Contributor
Contributor
Author

Thank you for the suggestion, it worked. But what's the issue in doing it in color by expression?

My measures were:

Complete: count(if(TRAINING_STATUS='Completed',TRAINING_STATUS ))

Pending: count(if(TRAINING_STATUS='Pending',TRAINING_STATUS ))

 

My expression was:

IF(TRAINING_STATUS='Completed', RGB(0, 128, 0), IF(TRAINING_STATUS='Pending', RGB(255, 0, 0)))

F_B
Creator III
Creator III

At first sight I would say that in your bar chart, you are showing the count of TRAINING_STATUS, while the color expression is evaluating the values of TRAINING_STATUS, two different things.

I'll have to look at it thoroughly to give you a better answer.

F_B
Creator III
Creator III

Did you check the box "The expression is a color code"?

1.PNG