Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Custom Colors in Qlik Sense

I am creating a stacked bar chart and I need custom colors so that positive slices are positive colors and negative slices are more negative related colors. In the image below, Ideally Passed would be green and on the bottom, followed by failed in red, incomplete in yellow and blocked in a different color.

Screen Shot 2017-01-30 at 8.24.49 AM.png

The Dimensions are projects and the Measures are the count of each of the statuses in "Latest Result".

There are three other fields that are identical except for the filter value(i.e. 'Passed'). Here is the formula used to calculate the measure:

Count({<[Latest Result]={'Passed'}>} [Latest Result])

Here is how I am trying to implement custom colors using the color expression:

Pick(Match([Latest Result],'Passed','Failed','Incomplete','Blocked'),green(),red(),yellow(),blue())

I have also used if statements that would ALWAYS return false so I think I might have string syntax incorrect. But when trying to use the pick(match()) formula the entire chart is grey.

ALSO NOTE: First post here so feel free to move or request edits to confirm to community formatting/rules.

9 Replies
MK9885
Master II
Master II

Maybe try this in Colors and Legend option>Custom Color>Color by Expression

If([Latest Result]='Passed', green(),

If([Latest Result]='Failed', red(),

If([Latest Result]='Incomplete', blue())))

Anonymous
Not applicable
Author

That does not catch any of the results. If I add yellow() as the not true condition for the "incomplete" if statement, the entire table is displayed in yellow.

MK9885
Master II
Master II

It should work if you've have those values (Passed,Failed,Incomplete and Blocked).

Can you post a sample here?

Anonymous
Not applicable
Author

I know the values exist as the chart renders correctly in regards to the sections of the stacks. Attached is a sample of the data in that column.

MK9885
Master II
Master II

I could you colors by same expression I provided.

Though it is not stacked bar chart but it should work. And if I use your measure for your sample data only Passed comes as it is set analysis and will ignore other values.

Hence I just used Count( Latest Results)

Capture.PNG

Anonymous
Not applicable
Author

Using your example, I was able to create the coloring in production, However, the X Axis(Dimensions) is a field that is filtering/sorting on. So I need the stacked bar chart to show the statuses sorta by the Dimension.
I can get the results to color if the Dimension is set at [Latest Result] but not when it is set to [Project] how I need it.

I have modified the Sheet you sent me to illustrate how I am trying to get it. I apologize for not sending it this way the first time. I am new to importing/exporting the tables in regards to scrubbing the data.

MK9885
Master II
Master II

The result will be the same....

I created separate dimensions for each value and used as Count(Passed), Count(Incomplete) etc.....

You can also use your Set expression w/o creating those dimensions and have them

Count({<[Latest Result]={'Failed','Passed','Incomplete','Blocked','UNEXPECTED'}>} [Latest Result])

I do not have field name [Project] in the XL file you've provided which you're referring to.

Anonymous
Not applicable
Author

Didn't realize that wasn't included. I updated both the qvf you uploaded and the excel file. I need the different columns(Stacked) to be by column. With only the segments/stacks colored by status.

The attached picture is the desired look however using custom colors instead of the default.(ie  blocked is bad and should not be green, passed should be green and on the bottom)

MK9885
Master II
Master II

I couldn't give the default view as colored. But upon selection it will give you Green, red, blue etc...

Also check these extensions

On new sheet I've built same bar chart with one of these extensions but only problem is the colors are not consistence.

Qlik Branch

Qlik Branch

Maybe an expert can help you more on coloring.

Thanks.