Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
william_britt
New Contributor

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
Khan_Mohammed
Honored Contributor II

Re: Custom Colors in Qlik Sense

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

william_britt
New Contributor

Re: Custom Colors in Qlik Sense

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.

Khan_Mohammed
Honored Contributor II

Re: Custom Colors in Qlik Sense

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

Can you post a sample here?

william_britt
New Contributor

Re: Custom Colors in Qlik Sense

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.

Khan_Mohammed
Honored Contributor II

Re: Custom Colors in Qlik Sense

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

william_britt
New Contributor

Re: Custom Colors in Qlik Sense

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.

Khan_Mohammed
Honored Contributor II

Re: Custom Colors in Qlik Sense

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.

william_britt
New Contributor

Re: Custom Colors in Qlik Sense

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)

Khan_Mohammed
Honored Contributor II

Re: Custom Colors in Qlik Sense

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.